Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class OVRMultiview

extends Object
Class Inheritance
Imports
org.lwjgl.system.*

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 gl_ViewID_OVR 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

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
GL_MAX_VIEWS_OVR

Accepted by the pname parameter of GetIntegerv.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native void
glFramebufferTextureMultiviewOVR(int
the framebuffer target. One of:
FRAMEBUFFERREAD_FRAMEBUFFERDRAW_FRAMEBUFFER
target
,
int attachment, int
the texture object to attach to the framebuffer attachment point named by attachment
texture
,
int
the mipmap level of texture to attach
level
,
int
the base framebuffer texture layer index
baseViewIndex
,
int
the number of views to target when rendering
numViews
)

Operates similarly to the FramebufferTextureLayer command, except that baseViewIndex and numViews select a range of texture array elements that will be targeted when rendering.

public static native void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVRback to summary
public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR

Accepted by the pname parameter of GetFramebufferAttachmentParameteriv.

GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVRback to summary
public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR

Accepted by the pname parameter of GetFramebufferAttachmentParameteriv.

GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVRback to summary
public static final int GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR

Returned by CheckFramebufferStatus.

GL_MAX_VIEWS_OVRback to summary
public static final int GL_MAX_VIEWS_OVR

Accepted by the pname parameter of GetIntegerv.

Constructor Detail

OVRMultiviewback to summary
protected OVRMultiview()

Method Detail

glFramebufferTextureMultiviewOVRback to summary
public static native void glFramebufferTextureMultiviewOVR(int target, int attachment, int texture, int level, int baseViewIndex, int numViews)

Operates similarly to the FramebufferTextureLayer command, except that baseViewIndex and numViews select a range of texture array elements that will be targeted when rendering. Such an attachment is considered multiview and rendering commands issued when such a framebuffer object is bound are termed "multiview rendering". The maximum number of views which can be bound simultaneously is determined by the value of MAX_VIEWS_OVR, which can be queried with the GetIntegerv command.

The command


View( uint id );

does not exist in the GL, but is used here to describe the multiview functionality in this section. The effect of this hypothetical function is to set the value of the shader built-in input gl_ViewID_OVR.

When multiview rendering is enabled, the Clear, ClearBuffer*, Draw*, and Dispatch* 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 of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is not NONE or the framebuffer is incomplete.

If texture is non-zero and the command does not result in an error, the framebuffer attachment state corresponding to attachment is updated as in the FramebufferTextureLayer command, except that the values of FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER and FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR are is set to baseViewIndex, and the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR is set to numViews.

Errors

In addition to the corresponding errors for FramebufferTextureLayer when called with the same parameters (other than layer):

An INVALID_VALUE error is generated if:

  • numViews is less than 1 or if numViews is greater than MAX_VIEWS_OVR.
  • texture is a two-dimensional array texture and baseViewIndex + numViews is larger than the value of MAX_ARRAY_TEXTURE_LAYERS minus one.
  • texture is non-zero and baseViewIndex is negative.

An INVALID_OPERATION error is generated if texture is non-zero and is not the name of a two-dimensional array texture.

Parameters
target:int

the framebuffer target. One of:

FRAMEBUFFERREAD_FRAMEBUFFERDRAW_FRAMEBUFFER
attachment:int

the attachment point of the framebuffer. One of:

COLOR_ATTACHMENT0COLOR_ATTACHMENT1COLOR_ATTACHMENT2COLOR_ATTACHMENT3
COLOR_ATTACHMENT4COLOR_ATTACHMENT5COLOR_ATTACHMENT6COLOR_ATTACHMENT7
COLOR_ATTACHMENT8COLOR_ATTACHMENT9COLOR_ATTACHMENT10COLOR_ATTACHMENT11
COLOR_ATTACHMENT12COLOR_ATTACHMENT13COLOR_ATTACHMENT14COLOR_ATTACHMENT15
COLOR_ATTACHMENT16COLOR_ATTACHMENT17COLOR_ATTACHMENT18COLOR_ATTACHMENT19
COLOR_ATTACHMENT20COLOR_ATTACHMENT21COLOR_ATTACHMENT22COLOR_ATTACHMENT23
COLOR_ATTACHMENT24COLOR_ATTACHMENT25COLOR_ATTACHMENT26COLOR_ATTACHMENT27
COLOR_ATTACHMENT28COLOR_ATTACHMENT29COLOR_ATTACHMENT30COLOR_ATTACHMENT31
DEPTH_ATTACHMENTSTENCIL_ATTACHMENTDEPTH_STENCIL_ATTACHMENT
texture:int

the texture object to attach to the framebuffer attachment point named by attachment

level:int

the mipmap level of texture to attach

baseViewIndex:int

the base framebuffer texture layer index

numViews:int

the number of views to target when rendering

glNamedFramebufferTextureMultiviewOVRback to summary
public static native void glNamedFramebufferTextureMultiviewOVR(int framebuffer, int attachment, int texture, int level, int baseViewIndex, int numViews)
Parameters
framebuffer:int

the framebuffer name

attachment:int

the attachment point of the framebuffer. One of:

COLOR_ATTACHMENT0COLOR_ATTACHMENT1COLOR_ATTACHMENT2COLOR_ATTACHMENT3
COLOR_ATTACHMENT4COLOR_ATTACHMENT5COLOR_ATTACHMENT6COLOR_ATTACHMENT7
COLOR_ATTACHMENT8COLOR_ATTACHMENT9COLOR_ATTACHMENT10COLOR_ATTACHMENT11
COLOR_ATTACHMENT12COLOR_ATTACHMENT13COLOR_ATTACHMENT14COLOR_ATTACHMENT15
COLOR_ATTACHMENT16COLOR_ATTACHMENT17COLOR_ATTACHMENT18COLOR_ATTACHMENT19
COLOR_ATTACHMENT20COLOR_ATTACHMENT21COLOR_ATTACHMENT22COLOR_ATTACHMENT23
COLOR_ATTACHMENT24COLOR_ATTACHMENT25COLOR_ATTACHMENT26COLOR_ATTACHMENT27
COLOR_ATTACHMENT28COLOR_ATTACHMENT29COLOR_ATTACHMENT30COLOR_ATTACHMENT31
DEPTH_ATTACHMENTSTENCIL_ATTACHMENTDEPTH_STENCIL_ATTACHMENT
texture:int

the texture object to attach to the framebuffer attachment point named by attachment

level:int

the mipmap level of texture to attach