3

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.

LandonSchropp
  • 10,084
  • 22
  • 86
  • 149

2 Answers2

2

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.

LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
1

A geometry shader works on entire primitives. Yours looks like it would only be suitable for points. If you are not passing in points you need to process all gl_VerticesIn (count) vertices.

Ben Jackson
  • 90,079
  • 9
  • 98
  • 150
  • The eventual plan is to have the shader process one point into more complex geometry. Right now I'm only passing through individual points. – LandonSchropp Nov 15 '10 at 10:20