Top Description Inners Fields Constructors Methods
jogamp.opengl.oculusvr

public Class OVRStereoDeviceRenderer

extends Object
implements StereoDeviceRenderer
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.util.stereo.StereoDeviceRenderer
Imports
java.nio.FloatBuffer, .ShortBuffer, java.util.Arrays, com.jogamp.nativewindow.util.DimensionImmutable, .RectangleImmutable, com.jogamp.opengl.GL, .GL2ES2, .GLArrayData, .GLException, .GLUniformData, .JoglVersion, jogamp.common.os.PlatformPropsImpl, com.jogamp.common.nio.Buffers, com.jogamp.oculusvr.OVR, .OVRException, .ovrDistortionMesh, .ovrDistortionVertex, .ovrEyeRenderDesc, .ovrFovPort, .ovrFrameTiming, .ovrHmdDesc, .ovrMatrix4f, .ovrPosef, .ovrRecti, .ovrSizei, .ovrTrackingState, .ovrVector2f, .ovrVector3f, com.jogamp.opengl.math.FloatUtil, com.jogamp.opengl.util.GLArrayDataServer, com.jogamp.opengl.util.glsl.ShaderCode, .ShaderProgram, com.jogamp.opengl.util.stereo.EyeParameter, .ViewerPose, .StereoDevice, .StereoDeviceRenderer, .StereoUtil

OculusVR Stereo Device Distortion and OpenGL Renderer Utility

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final OVRStereoDevice
private final int
private final OVRStereoDeviceRenderer.OVREye[]
private final DimensionImmutable[]
private int
private ovrFrameTiming
private final ovrVector3f[]
private final float[]
private final float[]
private final ovrPosef[]
private static final String
private static final String
private static final String
private static final String
private ShaderProgram
private final int
private final GLUniformData
private final DimensionImmutable
private final ovrTrackingState
private final ViewerPose

Constructor Summary

AccessConstructor and Description
pack-priv
OVRStereoDeviceRenderer(final OVRStereoDevice context, final int distortionBits, final int textureCount, final float[] eyePositionOffset, final ovrEyeRenderDesc[] eyeRenderDescs, final DimensionImmutable[] eyeTextureSizes, final DimensionImmutable totalTextureSize, final RectangleImmutable[] eyeViewports, final int textureUnit)

Method Summary

Modifier and TypeMethod and Description
public final void
beginFrame(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.beginFrame.

Notifying that a new frame is about to start.
public final void
dispose(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.dispose.

Release all OpenGL related resources
private static int
distBits2OVRDistCaps(final int distortionBits)

public final void
endFrame(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.endFrame.

Notifying that the frame has been rendered completely.
public StereoDevice
public final int
getDistortionBits()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getDistortionBits.

Returns used distortion compensation bits, e.g. DISTORTION_BARREL, in case the stereoscopic display requires such, i.e. in case lenses are utilized.
public final StereoDeviceRenderer.Eye
getEye(final int eyeNum)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEye.

Returns the Eye instance for the denoted eyeNum.
public final DimensionImmutable[]
getEyeSurfaceSize()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEyeSurfaceSize.

Returns the surface size for each eye's a single image in pixel units.
public final ViewerPose
public final int
getTextureCount()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureCount.

Returns the used texture-image count for post-processing, see ppAvailable().
public final int
getTextureUnit()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureUnit.

Returns the desired texture-image unit for post-processing, see ppAvailable().
public final DimensionImmutable
getTotalSurfaceSize()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTotalSurfaceSize.

Returns the total surface size required for the complete images in pixel units.
public final void
init(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.init.

Initialize OpenGL related resources
public final boolean
ppAvailable()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppAvailable.

Returns true if stereoscopic post-processing is required and available, otherwise false.
public final void
ppBegin(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppBegin.

Begin stereoscopic post-processing, see ppAvailable().
public final void
ppEnd(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppEnd.

End stereoscopic post-processing, see ppAvailable().
public final void
ppOneEye(final GL gl, final int eyeNum)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppOneEye.

Performs stereoscopic post-processing for one eye, see ppAvailable().
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public final ViewerPose
public final boolean
usesSideBySideStereo()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.usesSideBySideStereo.

Method returns true if using side-by-side (SBS) stereoscopic images, otherwise false.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

contextback to summary
private final OVRStereoDevice context
distortionBitsback to summary
private final int distortionBits
eyesback to summary
private final OVRStereoDeviceRenderer.OVREye[] eyes
eyeTextureSizesback to summary
private final DimensionImmutable[] eyeTextureSizes
frameCountback to summary
private int frameCount
frameTimingback to summary
private ovrFrameTiming frameTiming
hmdToEyeViewOffsetback to summary
private final ovrVector3f[] hmdToEyeViewOffset
mat4Tmp1back to summary
private final float[] mat4Tmp1
mat4Tmp2back to summary
private final float[] mat4Tmp2
ovrEyePosesback to summary
private final ovrPosef[] ovrEyePoses
shaderChromaSuffixback to summary
private static final String shaderChromaSuffix
shaderPlainSuffixback to summary
private static final String shaderPlainSuffix
shaderPrefix01back to summary
private static final String shaderPrefix01
shaderTimewarpSuffixback to summary
private static final String shaderTimewarpSuffix
spback to summary
private ShaderProgram sp
textureCountback to summary
private final int textureCount
texUnit0back to summary
private final GLUniformData texUnit0
totalTextureSizeback to summary
private final DimensionImmutable totalTextureSize
trackingStateback to summary
private final ovrTrackingState trackingState
viewerPoseback to summary
private final ViewerPose viewerPose

Constructor Detail

OVRStereoDeviceRendererback to summary
pack-priv OVRStereoDeviceRenderer(final OVRStereoDevice context, final int distortionBits, final int textureCount, final float[] eyePositionOffset, final ovrEyeRenderDesc[] eyeRenderDescs, final DimensionImmutable[] eyeTextureSizes, final DimensionImmutable totalTextureSize, final RectangleImmutable[] eyeViewports, final int textureUnit)

Method Detail

beginFrameback to summary
public final void beginFrame(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.beginFrame.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.beginFrame.

Notifying that a new frame is about to start.

Annotations
@Override
disposeback to summary
public final void dispose(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.dispose.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.dispose.

Release all OpenGL related resources

Annotations
@Override
distBits2OVRDistCapsback to summary
private static int distBits2OVRDistCaps(final int distortionBits)
endFrameback to summary
public final void endFrame(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.endFrame.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.endFrame.

Notifying that the frame has been rendered completely.

Annotations
@Override
getDeviceback to summary
public StereoDevice getDevice()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getDevice.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getDevice.

Returns the StereoDevice of this StereoDeviceRenderer instance.

Annotations
@Override
getDistortionBitsback to summary
public final int getDistortionBits()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getDistortionBits.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getDistortionBits.

Returns used distortion compensation bits, e.g. DISTORTION_BARREL, in case the stereoscopic display requires such, i.e. in case lenses are utilized.

Distortion requires post-processing.

Annotations
@Override
getEyeback to summary
public final StereoDeviceRenderer.Eye getEye(final int eyeNum)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEye.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEye.

Returns the Eye instance for the denoted eyeNum.

Annotations
@Override
getEyeSurfaceSizeback to summary
public final DimensionImmutable[] getEyeSurfaceSize()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEyeSurfaceSize.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getEyeSurfaceSize.

Returns the surface size for each eye's a single image in pixel units.

Annotations
@Override
getLastViewerPoseback to summary
public final ViewerPose getLastViewerPose()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getLastViewerPose.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getLastViewerPose.

Returns the last ViewerPose.

Annotations
@Override
getTextureCountback to summary
public final int getTextureCount()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureCount.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureCount.

Returns the used texture-image count for post-processing, see ppAvailable().

In case the renderer does not support multiple textures for post-processing, or no post-processing at all, method returns zero despite the request from StereoDevice#createRenderer(int, int, float[], com.jogamp.opengl.math.FovHVHalves[], float).

Annotations
@Override
getTextureUnitback to summary
public final int getTextureUnit()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureUnit.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTextureUnit.

Returns the desired texture-image unit for post-processing, see ppAvailable().

Annotations
@Override
getTotalSurfaceSizeback to summary
public final DimensionImmutable getTotalSurfaceSize()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTotalSurfaceSize.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.getTotalSurfaceSize.

Returns the total surface size required for the complete images in pixel units.

If usesSideBySideStereo() the total size spans over both getEyeSurfaceSize(), side-by-side.

Otherwise the size is equal to getEyeSurfaceSize().

Annotations
@Override
initback to summary
public final void init(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.init.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.init.

Initialize OpenGL related resources

Annotations
@Override
ppAvailableback to summary
public final boolean ppAvailable()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppAvailable.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppAvailable.

Returns true if stereoscopic post-processing is required and available, otherwise false.

Stereoscopic post-processing is available if:

If stereoscopic post-processing is used the following post-processing methods must be called to before endFrame():

Annotations
@Override
ppBeginback to summary
public final void ppBegin(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppBegin.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppBegin.

Begin stereoscopic post-processing, see ppAvailable().

updateViewerPose(int) for both eyes must be called upfront when rendering upstream StereoGLEventListener.

Annotations
@Override
ppEndback to summary
public final void ppEnd(final GL gl)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppEnd.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppEnd.

End stereoscopic post-processing, see ppAvailable().

Annotations
@Override
ppOneEyeback to summary
public final void ppOneEye(final GL gl, final int eyeNum)

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppOneEye.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.ppOneEye.

Performs stereoscopic post-processing for one eye, see ppAvailable().

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
updateViewerPoseback to summary
public final ViewerPose updateViewerPose()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.updateViewerPose.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.updateViewerPose.

Updates the ViewerPose and returns it.

Annotations
@Override
usesSideBySideStereoback to summary
public final boolean usesSideBySideStereo()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.usesSideBySideStereo.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.usesSideBySideStereo.

Method returns true if using side-by-side (SBS) stereoscopic images, otherwise false.

SBS requires that both eye's images are presented side-by-side in the final framebuffer.

Either the renderer presents the images side-by-side according to the eye's viewport, or post-processing is utilized to merge textures to a side-by-side configuration.

Annotations
@Override
jogamp.opengl.oculusvr back to summary

public Class OVRStereoDeviceRenderer.OVREye

extends Object
implements Eye
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.util.stereo.StereoDeviceRenderer.Eye

Field Summary

Modifier and TypeField and Description
private final int
private final int
private final EyeParameter
private final GLUniformData
private final GLUniformData
private final GLUniformData
private final GLUniformData
private final int
private final GLArrayDataServer
private final GLArrayDataServer
iVBO

2+2+2+2+2: { vec2 position, vec2 color, vec2 texCoordR, vec2 texCoordG, vec2 texCoordB }

pack-priv final ovrEyeRenderDesc
private final ovrFovPort
private final ovrMatrix4f[]
private final GLArrayData
private final GLArrayData
private final GLArrayData
private final GLArrayData
private final GLArrayData
private final int
private final RectangleImmutable

Constructor Summary

AccessConstructor and Description
pack-priv
OVREye(final ovrHmdDesc hmdDesc, final int distortionBits, final float[] eyePositionOffset, final ovrEyeRenderDesc eyeDesc, final ovrSizei ovrTextureSize, final RectangleImmutable eyeViewport)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
dispose(final GL2ES2 gl)

pack-priv void
enableVBO(final GL2ES2 gl, final boolean enable)

public final EyeParameter
public final RectangleImmutable
pack-priv void
linkData(final GL2ES2 gl, final ShaderProgram sp)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv void
updateTimewarp(final ovrHmdDesc hmdDesc, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2)

pack-priv void
updateUniform(final GL2ES2 gl, final ShaderProgram sp)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

distortionBitsback to summary
private final int distortionBits
eyeNameback to summary
private final int eyeName
eyeParameterback to summary
private final EyeParameter eyeParameter
eyeRotationEndback to summary
private final GLUniformData eyeRotationEnd
eyeRotationStartback to summary
private final GLUniformData eyeRotationStart
eyeToSourceUVOffsetback to summary
private final GLUniformData eyeToSourceUVOffset
eyeToSourceUVScaleback to summary
private final GLUniformData eyeToSourceUVScale
indexCountback to summary
private final int indexCount
indicesback to summary
private final GLArrayDataServer indices
iVBOback to summary
private final GLArrayDataServer iVBO

2+2+2+2+2: { vec2 position, vec2 color, vec2 texCoordR, vec2 texCoordG, vec2 texCoordB }

ovrEyeDescback to summary
pack-priv final ovrEyeRenderDesc ovrEyeDesc
ovrEyeFovback to summary
private final ovrFovPort ovrEyeFov
timeWarpMatricesback to summary
private final ovrMatrix4f[] timeWarpMatrices
vboParamsback to summary
private final GLArrayData vboParams
vboPosback to summary
private final GLArrayData vboPos
vboTexCoordsBback to summary
private final GLArrayData vboTexCoordsB
vboTexCoordsGback to summary
private final GLArrayData vboTexCoordsG
vboTexCoordsRback to summary
private final GLArrayData vboTexCoordsR
vertexCountback to summary
private final int vertexCount
viewportback to summary
private final RectangleImmutable viewport

Constructor Detail

OVREyeback to summary
pack-priv OVREye(final ovrHmdDesc hmdDesc, final int distortionBits, final float[] eyePositionOffset, final ovrEyeRenderDesc eyeDesc, final ovrSizei ovrTextureSize, final RectangleImmutable eyeViewport)

Method Detail

disposeback to summary
pack-priv void dispose(final GL2ES2 gl)
enableVBOback to summary
pack-priv void enableVBO(final GL2ES2 gl, final boolean enable)
getEyeParameterback to summary
public final EyeParameter getEyeParameter()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.Eye.getEyeParameter.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.Eye.getEyeParameter.

Returns the EyeParameter of this eye.

Annotations
@Override
getViewportback to summary
public final RectangleImmutable getViewport()

Implements com.jogamp.opengl.util.stereo.StereoDeviceRenderer.Eye.getViewport.

Doc from com.jogamp.opengl.util.stereo.StereoDeviceRenderer.Eye.getViewport.

Returns the viewport for this eye.

Annotations
@Override
linkDataback to summary
pack-priv void linkData(final GL2ES2 gl, final ShaderProgram sp)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
updateTimewarpback to summary
pack-priv void updateTimewarp(final ovrHmdDesc hmdDesc, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2)
updateUniformback to summary
pack-priv void updateUniform(final GL2ES2 gl, final ShaderProgram sp)