gl_Position Not Working in a Loop

It seems that gl_Position doesn’t let the shader link when inside a loop that uses a uniform variable as a end condition.

[NOTE]int current_level = 0;
uniform int lod_level = 1;
while(current_level < lod_level)
{
current_level++;
gl_Position = pos;
EmitVertex();
}[/NOTE]

This isn’t all the code, but commenting out gl_positon or changing the while loop to;

[NOTE]while(current_level < 2)[/NOTE]

will then work

Hope someone can shed some light on this. Thanks.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.