Geometry Shader/Defined Inputs Layered: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
separate page for built-in inputs.
 
Page no longer needed. Well, it was never *needed*...
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Layered rendering in the {{pagelink|Geometry Shader|GS}} works via two special output variables:
#REDIRECT [[Geometry Shader]]
 
<source lang="glsl">
out int gl_Layer;
out int gl_ViewportIndex; //Requires GL 4.1 or ARB_viewport_array.
</source>
 
The {{code|gl_Layer}} output defines which layer in the layered image the primitive goes to. Each vertex in the primitive must get the same layer index. Note that when rendering to cubemap arrays, the {{code|gl_Layer}} value represents layer-faces (the faces within a layer), not the layers of cubemaps.
 
{{code|gl_ViewportIndex}}, which requires GL 4.1 or {{extref|viewport_array}}, specifies which viewport index to use with this primitive.
 
{{note|{{extref|viewport_array}}, while technically a 4.1 feature, is widely available on 3.3 hardware, from both NVIDIA and AMD.}}

Latest revision as of 17:09, 18 December 2014

Redirect to: