CardboardView.Renderer

public static interface CardboardView.Renderer

Interface for renderers who need to handle all the stereo rendering details by themselves.

Public Methods

abstract void onDrawFrame(HeadTransformheadTransform,EyeleftEye,EyerightEye)
abstract void onFinishFrame(Viewportviewport)
abstract void onRendererShutdown()
abstract void onSurfaceChanged(int width, int height)
abstract void onSurfaceCreated(EGLConfig config)

Public Methods

public abstract voidonDrawFrame(HeadTransformheadTransform,EyeleftEye,EyerightEye)

Requests to draw a new frame.

The implementor is assumed to handle all stereoscopic details by itself by making use of the provided head transformation and eye parameters.

If distortion correction is enabled the GL context will be set to draw into a framebuffer backed by a texture at the time of this call. If an implementor needs to change the current framebuffer, it must be reset back afterwards to the one obtained viaglGetIntegerv(GL_FRAMEBUFFER_BINDING, ...)at the beginning of this call.

If VR mode is disabled, instead of providing the parameters of two eyes, the left eye will contain monocular rendering parameters and the right eye will be null. No distortion correction will take place in that case. For monocular rendering, the implementor should feel free to ignore the FieldOfView and instead create a perspective matrix with whatever field of view is desired for monocular rendering (ScreenParams.getWidth()/ScreenParams.getHeight() can provide the aspect ratio). See thesetVRModeEnabledmethod for details.

Parameters
headTransform The head transformation for this frame, independent to any eyes.
leftEye Parameters of the left eye, or a single eye if VR mode is disabled.
rightEye Parameters of the right eye, or null if VR mode is disabled.

public abstract voidonFinishFrame(Viewportviewport)

Called before a frame is finished.

By the time of this call, the frame contents have been already drawn and, if enabled, distortion correction has been applied.

This method allows to perform additional overlay rendering over the frame results. For example, it could be used to draw markers that help users to properly center their device screens in their Cardboards.

A viewport object describing the bounds of the full surface is provided, but not set in the GL context.Rendererimplementors are responsible of setting the viewport if needed.

Parameters
viewport Viewport of the full GL surface. To be set by renderers if needed.

public abstract voidonRendererShutdown()

Called on the renderer thread when the thread is shutting down.

Allows releasing GL resources and performing shutdown operations in the renderer thread. Called only if there was a previous call toonSurfaceCreated.

public abstract voidonSurfaceChanged(int width, int height)

Called when there is a change in the surface dimensions.

Viewport, field of view and projection details are automatically updated.

Note that the eye parameters passed toonDrawFrame(HeadTransform, Eye, Eye)are computed under the assumption that the surface dimensions correspond to a fullscreen landscape view. Any other configuration is likely to lead to convergence problems.

Parameters
width New width of the surface in pixels.
height New height of the surface in pixels.

public abstract voidonSurfaceCreated(EGLConfig config)

Called when the surface is created or recreated.

Parameters
config The EGL configuration used when creating the surface.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android解析服务器端发来的xml数据示例
  2. android面试题总结
  3. Android绘图之2D绘图基础
  4. Mac上如何使用adb命令进行操作?(Android(安
  5. selector 及 Shape 小结
  6. Android蓝牙开发浅析
  7. 前言
  8. Android(安卓)程序的动态调试
  9. Android之MPAndroidChart库使用说明(柱状
  10. Ubuntu11.10下编译android内核源码