Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top