My geometric shader is exactly the same as the one on this page.
Yes, but your auxiliary vertex and fragment shaders are missing.
Information passes through the OpenGL pipeline as follows: firstly, the vertex shader receives material. It passes its results to the geometric shader, if present. The geometric shader passes its outputs to the fragment shader (of course, due to the usual decoding of the triangle). And the fragment shader transfers its outputs to the mixing stage.
Your vertex shader has two outputs: gl_Position and vertexColor . However, your geometry shader only accepts one input: gl_in[0].gl_Position . This is not legal in GLSL: if one step returns a value, the next step is to enter it. The only exceptions are GLSL values, such as gl_Position , which are consumed by the rasterizer.
Your end-to-end GS should actually transmit data if you want them to pass through the pass. You need to enter the correct input in GS:
in vec4 vertexColor[];
However, global variables in GLSL cannot be called the same. Thus, you cannot accept vertexColor as input and as a result. So instead, you need to change the output name (or use interface blocks ):
out vec4 gsColor;
Now your fragment shader should accept in vec4 gsColor; and work with him.
When you tried to link these shaders, your compiler should have provided you with an appropriate information log explaining the mismatch. Do you get your newsletters when your shaders do not connect? If not, you should.
source share