It compiles and links without error, and runs correctly. When I query the log, using glGetProgramInfoLog, it contains the following warning:
Geometry info
0(21) : warning C7050: “gl_Position” might be used before being initialized
It is referring to the gl_Position on the left-hand side of the equals operator, since if I replace that with “vec4 foo”, there are no warnings. I am using gl_Position in the same manner as every geometry shader example I’ve come across. Do you know what I’m doing wrong or any workarounds?
I am running on NVIDIA GeoForce 8 with 195.62 drivers.
Perhaps I should ask if anyone can share a pass-through geometry shader that doesn’t have this warning in glGetProgramInfoLog? Maybe this is only present on NVIDIA?
What appears to me might be the issue is that if gl_in.length() == 0, gl_Position will never be set.
As a blindfold shot over the shoulder, might try initializing gl_Position “before” the loop.
That is a pretty good blindfold shot. Adding “gl_Position = vec4(0);” before the for loop eliminates the warning. I bet the optimizer will be able to get rid of this line since gl_Position is written again before the first call to EmitVertex(), making this assignment to gl_Position unnecessary.
I’m not thrilled with this but it gets the job done. Thanks again!
Is it actually possible for gl_in.length() to be zero in a geometry shader? Wouldn’t that mean a glDraw call with 0 elements, and thus no need to invoke the pipeline?