PDA

View Full Version : gl_PerVertex does not work



Worker
04-01-2013, 12:31 PM
Hello

I have made a simple geometry shader,
but it doesn't work correct.

The first example runs correct, but with the second,
i see nothing :

First example (runs correct):
#version 420 core
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;

in vec4 color[];
out vec4 col;

out gl_PerVertex
{
vec4 gl_Position;

}vertexOut;

void main()
{
for(int i=0; i<3; i++)
{
gl_Position = gl_in[i].gl_Position;
/*vertexOut.gl_Position = vec4(gl_in[i].gl_Position); */
col = color[i];
EmitVertex();
}
EndPrimitive ();
}

Second example (see nothing on the screen):
#version 420 core
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;

in vec4 color[];
out vec4 col;

out gl_PerVertex
{
vec4 gl_Position;

}vertexOut;

void main()
{
for(int i=0; i<3; i++)
{
/* gl_Position = gl_in[i].gl_Position; */
vertexOut.gl_Position = vec4(gl_in[i].gl_Position);
col = color[i];
EmitVertex();
}
EndPrimitive ();
}

I can't found the error in the code. What can it be?

Bye