layout (points) in; layout (triangle_strip) out; layout (max_vertices = 4) out; // OF handled uniforms and attributes. uniform mat4 projectionMatrix; // App specific uniforms and attributes. // uniform float uSpriteSize; in vec4 vPosition[]; in vec2 vTexCoord[]; flat in int vValid[]; out vec2 texCoordVarying; in vec3 vPos[]; in vec4 vTarget[]; in float vTemperature[]; in float vAge[]; // out vec2 gTexCoord; out vec3 gPos; out vec4 gTarget; out float gTemperature; out float gAge; void main() { float uSpriteSize = 1.5; // if (vValid[0] == 0) return; texCoordVarying = vTexCoord[0]; gPos = vPos[0]; gTarget = vTarget[0]; gTemperature = vTemperature[0]; gAge = vAge[0]; for (int i = 0; i < gl_in.length(); ++i) { gl_Position = projectionMatrix * (vPosition[i] + vec4(1.0, -1.0, 0.0, 0.0) * uSpriteSize); EmitVertex(); gl_Position = projectionMatrix * (vPosition[i] + vec4(1.0, 1.0, 0.0, 0.0) * uSpriteSize); EmitVertex(); gl_Position = projectionMatrix * (vPosition[i] + vec4(-1.0, -1.0, 0.0, 0.0) * uSpriteSize); EmitVertex(); gl_Position = projectionMatrix * (vPosition[i] + vec4(-1.0, 1.0, 0.0, 0.0) * uSpriteSize); EmitVertex(); EndPrimitive(); } }