I started with a working OpenGL program (with vertex and fragment shaders) that draws a single GL_POINT. Then I attached a simple geometry shader that outputs two points given a single point as input:
#version 400
layout(points) in;
layout(points, max_vertices = 2) out;
void main() {
gl_Position = gl_in[0].gl_Position;
EmitVertex();
gl_Position = gl_in[0].gl_Position + vec4(0.1, 0, 0, 1);
EmitVertex();
EndPrimitive();
}
When I run my program I get the following compilation errors from GL:
Error Compiling Shader: ERROR: 0:4: Invalid use of layout 'points'
ERROR: 0:5: Invalid use of layout 'points'
ERROR: 0:9: Use of undeclared identifier 'gl_Position'
ERROR: 0:9: Use of undeclared identifier 'gl_in'
ERROR: 0:10: Call to undeclared function 'EmitVertex'
ERROR: 0:12: Use of undeclared identifier 'gl_Position'
ERROR: 0:12: Use of undeclared identifier 'gl_in'
ERROR: 0:13: Call to undeclared function 'EmitVertex'
ERROR: 0:16: Call to undeclared function 'EndPrimitive'
My System Specs:
Mac OSX 10.9, Nvidia Geforce 750M, OpenGL 4.1 driver
I also tried defining the following in my geometry shader:
#extension GL_EXT_geometry_shader4: enable
But my driver does not support the extension. This shouldn't be needed though since geometry shaders are apart of core since 3.2 (source: https://www.opengl.org/wiki/Geometry_shader#See_also)
Any thoughts?