Skip to content

vaPosition

in vec3 vaPosition;

Valid Programs: all gbuffers/shadow


The vertex position attribute. For terrain this is relative to the chunk and you must add chunkOffset as shown below:

vec3 model_pos = vaPosition + chunkOffset;
vec4 view_pos = modelViewMatrix * vec4(model_pos, 1.0);
vec4 clip_pos = projectionMatrix * view_pos;
gl_Position = clip_pos;

For all other geometry, vaPosition directly stores the model space position. In either case, the model space position is equivalent to gl_Vertex.xyz from the compatibility profile.

vec3 model_pos = gl_Vertex.xyz;
vec4 view_pos = gl_ModelViewMatrix * vec4(model_pos, 1.0);
vec4 clip_pos = gl_ProjectionMatrix * view_pos;
gl_Position = clip_pos;