Search code examples
cocoaopenglgeometry-shader

OpenGL Geometry Shader Mac OS X


I'm trying to get a simple pass through geometry shader to work under Mac OS X 10.6. The code compiles and links without problem, but for some reason no geometry is being drawn to the screen. Here's my shader code:

#version 120
#extension GL_EXT_geometry_shader4: enable

void main()
{
    gl_Position = gl_PositionIn[0];
    EmitVertex();

    EndPrimitive();
}

If anybody could help I'd appreciate it.


Solution

  • So as it turns out, the problem wasn't in the shader code at all. Apparently, when using version 120 in a geometry shader, you have to set the input and output types as follows:

    glProgramParameteriEXT(shaderProgramID, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_POINTS);
    glProgramParameteriEXT(shaderProgramID, GL_GEOMETRY_VERTICES_OUT_EXT, GL_POINTS);
    

    After that everything worked out perfectly.