I’m learning how to use the geometry shader and managed to display vertex normals. But when I use this shader type, the only colors I see are (default) black lines representing the normals. My texture and lighting disappears.
Is there a way I can render primitives with the geometry shader without the texture and lighting disappearing? My guess is creating another VBO just for geometry shader work, but I’m sure I’m wrong.
I’ll share what I got for the vertex and geometry shaders so far, thanks in advanced!
The only variables which your geometry shader outputs are color0 and gl_Position, and color0 isn’t being set prior to the EmitVertex() calls, so its value in the fragment shader is undefined. If you want to output other variables, you have to define them as outputs and set their values prior to the EmitVertex() call.
If you want to pass variables through the geometry shader, you have to define them as both inputs and outputs (either with different names or using interface blocks) and copy the input to the output prior to each EmitVertex() call. This won’t happen automatically; when a geometry shader is used, the only variables available to the fragment shader are those which are declared as outputs in the geometry shader. Vertex shader outputs are only available to the geometry shader.
[QUOTE=GClements;1283989]The only variables which your geometry shader outputs are color0 and gl_Position, and color0 isn’t being set prior to the EmitVertex() calls, so its value in the fragment shader is undefined. If you want to output other variables, you have to define them as outputs and set their values prior to the EmitVertex() call.
If you want to pass variables through the geometry shader, you have to define them as both inputs and outputs (either with different names or using interface blocks) and copy the input to the output prior to each EmitVertex() call. This won’t happen automatically; when a geometry shader is used, the only variables available to the fragment shader are those which are declared as outputs in the geometry shader. Vertex shader outputs are only available to the geometry shader.[/QUOTE]
As always thanks again GC, you’re right! I was expecting this process to happen automatically, wrong thinking.