Frage

I have a VBO with points in it, that I can render fine with a vertex and fragment shader, but when I add a pass through geometry shader, I see nothing. I'm using MRT for glow, but in this example I don't touch it.

From what I've seen on other posts, it looks like there may be issues with passing values from one stage to another, so I removed all my varyings but it still does not work.

I set up the program parameters after linking - hopefully that's alright.

Any ideas why disabling the geometry shader produces white particles, but enabling it shows nothing?

VERTEX SHADER:

#version 120
attribute vec3 position;
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;

void main()
{
    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1);
}

FRAGMENT SHADER:

#version 120

void main()
{
    gl_FragData[0] = vec4(1.f, 1.f, 1.f, 1.f);
    gl_FragData[1] = vec4(0.f, 0.f, 0.f, 0.f);
}

GEOMETRY SHADER:

#version 120
#extension GL_EXT_geometry_shader4: enable

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;

void main(void)
{
    for (int i = 0; i < gl_VerticesIn; i++)
    {
        gl_Position = gl_PositionIn[i];
        EmitVertex();
    }
        EndPrimitive();
}

Setting up params (after program linking, program is resources.particleprogram)

glProgramParameteriEXT(resources.particleprogram, GL_GEOMETRY_INPUT_TYPE_EXT, GL_POINTS);
glProgramParameteriEXT(resources.particleprogram, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_POINTS);
glProgramParameteriEXT(resources.particleprogram, GL_GEOMETRY_VERTICES_OUT_EXT, 4);
War es hilfreich?

Lösung

Setting up params (after program linking, program is resources.particleprogram)

These parameters must be set before linking.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top