Difference between revisions of "Geometry Shader/Defined Inputs"

From OpenGL Wiki
Jump to: navigation, search
(separate page for built-in inputs.)
(No difference)

Revision as of 06:15, 26 July 2013

Geometry Shaders provide the following built-in input variables:

in gl_PerVertex
{
  vec4 gl_Position;
  float gl_PointSize;
  float gl_ClipDistance[];
} gl_in[];

These values don't really mean anything; they're just whatever the prior stage wrote to them.

There are some GS input values that are based on primitives, not vertices. These are not aggregated into arrays. These are:

in int gl_PrimitiveIDIn;
in int gl_InvocationID;  //Requires GLSL 4.0 or ARB_gpu_shader5

gl_PrimitiveIDIn is the current input primitive's ID, based on the number of primitives processed by the GS since the current rendering command started.

gl_InvocationID is the current instance, as defined when instancing geometry shaders.