Class OVRMultiview
- java.lang.Object
-
- org.lwjgl.opengl.OVRMultiview
-
public class OVRMultiview extends java.lang.Object
Native bindings to the OVR_multiview extension.The method of stereo rendering supported in OpenGL is currently achieved by rendering to the two eye buffers sequentially. This typically incurs double the application and driver overhead, despite the fact that the command streams and render states are almost identical.
This extension seeks to address the inefficiency of sequential multiview rendering by adding a means to render to multiple elements of a 2D texture array simultaneously. In multiview rendering, draw calls are instanced into each corresponding element of the texture array. The vertex program uses a new ViewID variable to compute per-view values, typically the vertex position and view-dependent variables like reflection.
The formulation of this extension is high level in order to allow implementation freedom. On existing hardware, applications and drivers can realize the benefits of a single scene traversal, even if all GPU work is fully duplicated per-view. But future support could enable simultaneous rendering via multi-GPU, tile-based architectures could sort geometry into tiles for multiple views in a single pass, and the implementation could even choose to interleave at the fragment level for better texture cache utilization and more coherent fragment shader branching.
The most obvious use case in this model is to support two simultaneous views: one view for each eye. However, we also anticipate a usage where two views are rendered per eye, where one has a wide field of view and the other has a narrow one. The nature of wide field of view planar projection is that the sample density can become unacceptably low in the view direction. By rendering two inset eye views per eye, we can get the required sample density in the center of projection without wasting samples, memory, and time by oversampling in the periphery.
Requires
OpenGL 3.0
.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVRAccepted by thepname
parameter of GetFramebufferAttachmentParameteriv.static int
GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR
Returned by CheckFramebufferStatus.static int
GL_MAX_VIEWS_OVR
Accepted by thepname
parameter of GetIntegerv.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
glFramebufferTextureMultiviewOVR(int target, int attachment, int texture, int level, int baseViewIndex, int numViews)
Operates similarly toFramebufferTextureLayer
, except thatbaseViewIndex
andnumViews
selects a range of texture array elements that will be targeted when rendering.
-
-
-
Field Detail
-
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR
Accepted by thepname
parameter of GetFramebufferAttachmentParameteriv.
-
GL_MAX_VIEWS_OVR
Accepted by thepname
parameter of GetIntegerv.
-
GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR
Returned by CheckFramebufferStatus.
-
-
Method Detail
-
glFramebufferTextureMultiviewOVR
public static void glFramebufferTextureMultiviewOVR(int target, int attachment, int texture, int level, int baseViewIndex, int numViews)
Operates similarly toFramebufferTextureLayer
, except thatbaseViewIndex
andnumViews
selects a range of texture array elements that will be targeted when rendering.The command
View( uint id );
does not exist in the GL, but is used here to describe the multi-view functionality in this section. The effect of this hypothetical function is to set the value of the shader built-in input uint
gl_ViewID_OVR
.When multi-view rendering is enabled, drawing commands have the same effect as:
for( int i = 0; i < numViews; i++ ) { FramebufferTextureLayer( target, attachment, texture, level, baseViewIndex + i ); View( i ); <drawing-command> }
The result is that every drawing command is broadcast into every active view. The shader uses
gl_ViewID_OVR
to compute view dependent outputs.The number of views, as specified by
numViews
, must be the same for all framebuffer attachments points where the value ofFRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
is notNONE
or the framebuffer is incomplete.In this mode there are several restrictions:
- in vertex shader
gl_Position
is the only output that can depend onViewID
- no transform feedback
- no tessellation control or evaluation shaders
- no geometry shader
- no timer query
- occlusion query results must be between max and sum of per-view queries, inclusive
Errors
INVALID_OPERATION
is generated by FramebufferTextureMultiviewOVR if target isREAD_FRAMEBUFFER
.INVALID_VALUE
is generated by FramebufferTextureMultiviewOVR ifnumViews
is less than 1, ifnumViews
is more thanMAX_VIEWS_OVR
or if(baseViewIndex + numViews)
exceedsMAX_ARRAY_TEXTURE_LAYERS
.INVALID_OPERATION
is generated if a rendering command is issued and the number of views in the current draw framebuffer is not equal to the number of views declared in the currently bound program.- Parameters:
target
- the framebuffer target. One of:FRAMEBUFFER
READ_FRAMEBUFFER
DRAW_FRAMEBUFFER
attachment
- the attachment point of the framebuffer. One of:texture
- the texture object to attach to the framebuffer attachment point named byattachment
level
- the mipmap level oftexture
to attachbaseViewIndex
- the base framebuffer texture layer indexnumViews
- the number of views to target when rendering
- in vertex shader
-
-