I am wanting to be able to render objects with a geometry shader and allow them to rotate with the camera perspective...this is what I have so far, as a example
Vertex shader
#version 400 core
uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
void main()
{
vec4 worldPosition = transformationMatrix * vec4(0,0,0, 1.0);
vec4 positionRelitiveToCam = viewMatrix * worldPosition;
gl_Position = projectionMatrix * positionRelitiveToCam;
}
Geometry Shader
#version 400 core
layout(points) in;
layout(triangle_strip, max_vertices = 3) out;
void main() {
gl_Position = gl_in[0].gl_Position + vec4(-1.0, 0.0, 0.0, 0.0);
EmitVertex();
gl_Position = gl_in[0].gl_Position + vec4(1.0, 0.0, 0.0, 0.0);
EmitVertex();
gl_Position = gl_in[0].gl_Position + vec4(0.0, 2.0, 0.0, 0.0);
EmitVertex();
EndPrimitive();
}
As you can see, I am able to draw a triangle with POV working but as I rotate around it, the triangle does not rotate. Ideas?