framebufferTextureMultiviewWEBGL
with a non-null texture
parameter that does not identify a 2D array texture generates an INVALID_OPERATION
error.
baseViewIndex
and numViews
can result in an error only if the texture
parameter is non-null.
baseViewIndex
is not the same for all framebuffer attachment points where the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
is not NONE
the framebuffer is considered incomplete. Calling getFramebufferStatus
for a framebuffer in this state returns FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR
. Other rules for framebuffer completeness from the OVR_multiview specification also apply.
WebGLFramebuffer
objects that act as if they have multi-view attachments, but their attachments are not exposed as textures or renderbuffers and can not be changed. Opaque multiview framebuffers may have any combination of color, depth and stencil attachments.
framebufferRenderbuffer
, framebufferTexture2D
, framebufferTextureLayer
, framebufferTextureMultiviewWEBGL
, or any other call that could change framebuffer attachments with an opaque multiview framebuffer bound to target
generates an INVALID_OPERATION
error.
target
when calling getFramebufferAttachmentParameter
, then attachment
must be BACK
, DEPTH
, or STENCIL
.
target
when calling getFramebufferAttachmentParameter
, then pname
must not be FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
.
FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR
on an opaque multiview framebuffer attachment point that has attachments must return the number of views in the opaque multiview framebuffer.
FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR
on an opaque multiview framebuffer must return 0.
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
on an opaque multiview framebuffer must return FRAMEBUFFER_DEFAULT
.
MAX_VIEWS_OVR
).
deleteFramebuffer
generates an INVALID_OPERATION
error.
#extension GL_OVR_multiview
directive, as shown in the sample code, to use
the extension in a shader.
Likewise the shading language preprocessor #define GL_OVR_multiview
, will be defined to 1 if the extension is supported.
gl_Position
can depend on ViewID in the vertex shader. With this change, view-dependent outputs like reflection vectors and similar are allowed.
gl_ViewID_OVR
will always evaluate to zero.
GL_OVR_multiview
with an extension directive, layout
is treated as a keyword rather than an identifier, and using a layout qualifier to specify num_views
is allowed. Other uses of layout qualifiers are not allowed in OpenGL ES shading language 1.00.
gl_ViewID_OVR
has the type int
as opposed to uint
.
clear
generates an INVALID_OPERATION
error.
INVALID_OPERATION
error.
GL_OVR_multiview
with an extension directive:
gl_ViewID_OVR
is a built-in input of the type uint.GL_OVR_multiview
is defined as 1.
pname
set to MAX_VIEWS_OVR
returns the maximum number of views. The implementation must support at least 2 views.
pname | returned type |
---|---|
MAX_VIEWS_OVR | GLint |
pname
parameter set to FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR
returns the number of views of the framebuffer object attachment.
Calling with the pname
parameter set to FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR
returns the base view index of the framebuffer object attachment.
pname | returned type |
---|---|
FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR | GLsizei |
FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR | GLint |
INVALID_OPERATION
is generated by calling framebufferTextureMultiviewWEBGL
with a texture
parameter that does not identify a 2D array texture.
INVALID_OPERATION
is generated by calling framebufferRenderbuffer
, framebufferTexture2D
, framebufferTextureLayer
, or framebufferTextureMultiviewWEBGL
with a target
parameter that identifies an opaque multiview framebuffer.
INVALID_OPERATION
is generated by calling deleteFramebuffer
with a buffer
parameter that identifies an opaque multiview framebuffer.
INVALID_ENUM
is generated by calling getFramebufferAttachmentParameter
with an attachment
parameter other than BACK
, DEPTH
or STENCIL
when the target
parameter identifies an opaque multiview framebuffer.
INVALID_ENUM
is generated by calling getFramebufferAttachmentParameter
with the pname
parameter set to FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
when the target
parameter identifies an opaque multiview framebuffer.
INVALID_VALUE
is generated by calling framebufferTextureMultiviewWEBGL
with a non-null texture
in the following cases:
numViews
is less than onenumViews
is more than MAX_VIEWS_OVR
baseViewIndex
+ numViews
is larger than the value of MAX_ARRAY_TEXTURE_LAYERS
baseViewIndex
is negativeINVALID_FRAMEBUFFER_OPERATION
is generated by commands that read from the framebuffer such as BlitFramebuffer
, ReadPixels
, CopyTexImage*
, and CopyTexSubImage*
, if the number of views in the current read framebuffer is greater than one.
INVALID_OPERATION
is generated by attempting to draw if the active program declares a number of views and the number of views in the draw framebuffer does not match the number of views declared in the active program.
INVALID_OPERATION
is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and the active program does not declare a number of views.
INVALID_OPERATION
is generated by attempting to draw if the number of views in the current draw framebuffer is greater than one and transform feedback is active.
INVALID_OPERATION
is generated by attempting to draw or calling clear
if the number of views in the current draw framebuffer is greater than one and a timer query is active.
var gl = document.createElement('canvas').getContext('webgl2'); var ext = gl.getExtension('WEBGL_multiview'); var fb = gl.createFramebuffer(); gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fb); var colorTex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D_ARRAY, colorTex); gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, 512, 512, 2); ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.COLOR_ATTACHMENT0, colorTex, 0, 0, 2); var depthStencilTex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D_ARRAY, depthStencilTex); gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, 512, 512, 2); ext.framebufferTextureMultiviewWEBGL(gl.DRAW_FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, depthStencilTex, 0, 0, 2); gl.drawElements(...); // draw will be broadcasted to the layers of colorTex and depthStencilTex.
var gl = document.createElement('canvas').getContext('webgl'); var ext = gl.getExtension('WEBGL_multiview'); // ... obtain opaque multiview framebuffer "fb" from another web API here ... gl.bindFramebuffer(gl.FRAMEBUFFER, fb); gl.drawElements(...); // draw will be broadcasted to the views of the opaque multiview framebuffer. // You can not call framebufferTextureMultiviewWEBGL to change the attachments of "fb", only draw to it.
#version 300 es #extension GL_OVR_multiview : require precision mediump float; layout (num_views = 2) in; in vec4 inPos; uniform mat4 u_viewMatrix0; uniform mat4 u_viewMatrix1; void main() { if (gl_ViewID_OVR == 0u) { gl_Position = u_viewMatrix0 * inPos; } else { gl_Position = u_viewMatrix1 * inPos; } }