public class DistortionRenderer

Encapsulates the rendering operations to correct lens distortion.

This class is not thread-safe. For performance reasons, exposed public methods in this class are assumed to run in mutual exclusion (e.g. in the same or non-overlapping threads).

Public Constructors

DistortionRenderer()

Public Methods

void afterDrawFrame()
void beforeDrawFrame()
boolean haveViewportsChanged()
void onFovChanged(HeadMountedDisplayhmd,FieldOfViewleftFov,FieldOfViewrightFov, float virtualEyeToScreenDistance)
void setRestoreGLStateEnabled(boolean enabled)
void setVignetteEnabled(boolean enabled)
void undistortTexture(int textureId)
void updateViewports(ViewportleftViewport,ViewportrightViewport)

Inherited Methods

From class java.lang.Object

Public Constructors

publicDistortionRenderer()

Public Methods

public voidafterDrawFrame()

Performs distortion correction.

Must be called after drawing a frame to correct its distortion. Note that this method is only allowed to modify the parts of the OpenGL state machine which are backed up and restored using a GLStateBackup object.

public voidbeforeDrawFrame()

Performs the required setup to correct distortion.

Must be called before drawing a frame that should be undistorted.

public booleanhaveViewportsChanged()

Checks if the distortion-corrected dimensions of the viewports have changed since the last call toupdateViewports.

Returns
  • trueif the dimensions have changed,falseotherwise.

public voidonFovChanged(HeadMountedDisplayhmd,FieldOfViewleftFov,FieldOfViewrightFov, float virtualEyeToScreenDistance)

To be called when a change in the field of view of any eye happens.

Must be called at least once prior tobeforeDrawFrame(). Calling this method betweenbeforeDrawFrame()andafterDrawFrame()calls will raise anIllegalStateException.

This method might recompute the mesh used for distortion correction, but no changes involving GL calls will take place untilbeforeDrawFrame()is called.

Parameters
hmd The head mounted display.
leftFov The field of view of the left eye.
rightFov The field of view of the right eye.
virtualEyeToScreenDistance The virtual-eye-to-screen distance in meters.

public voidsetRestoreGLStateEnabled(boolean enabled)

Enables or disables restoration of the application's GL state after postprocessing.

If this flag is enabled, the framework ensures that the GL state at the beginning of the next frame is equivalent to the GL state at the end of the last frame.

Enabled by default.

Parameters
enabled trueto enable GL state restoration,falseto disable.

public voidsetVignetteEnabled(boolean enabled)

Enables or disables vignetting around frame edge.

If this flag is enabled, the distortion shader applies a darkening effect to the edges of the visible viewport, simulating vignetting.

Enabled by default.

Parameters
enabled trueto enable vignette effect,falseto disable.

public voidundistortTexture(int textureId)

Undistorts the provided texture by rendering into the current output target.

This method should not be directly called when using thebeforeDrawFrame()andafterDrawFrame()methods.

Parameters
textureId Texture to undistort.

public voidupdateViewports(ViewportleftViewport,ViewportrightViewport)

Updates the eye viewports to their effective dimensions after distortion correction.

Parameters
leftViewport Object updated with the viewport for the left eye.
rightViewport Object updated with the viewport for the right eye.

更多相关文章

  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兼容性问题 -- SparseArray.clone
  2. 如何编译 MTK 的模拟器(android)
  3. Android背景颜色渐变
  4. Android(安卓)MediaScanner源代码解析
  5. 创建 Android虚拟设备(AVD)
  6. ubuntu下挂载android sdcard
  7. android中在子线程中更新UI的几种方法
  8. 获取资源的id
  9. Android第一个功能:手机拨号器
  10. android studio中xml文件代码提示问题