Geometry Shader/Defined Inputs

From OpenGL Wiki
Jump to navigation Jump to search

Geometry Shaders provide the following built-in input variables:

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

These variables have only the meaning the prior shader stage(s) that passed them gave 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
the current input primitive's ID, based on the number of primitives processed by the GS since the current drawing command started.
the current instance, as defined when instancing geometry shaders.