Passing variable variables through a geometry shader

I have provided a geometry shader for my OpenGL application. My shaders have a few "variables" variables that I pass from the vertex shader to the fragment shader. Now, having introduced the geometry shader, I need to manually pass each variable in the geometry shader for each vertex. Is there a way to avoid this and do things "automatically"?

+3


source to share


2 answers


Not.



Once you inject a geometry shader into your pipeline, if you want to pass variables from the vertex shader to the fragment shader, you must pass them manually by creating an input variable from the vertex shader and an output variable to the fragment shader. I don't know which version of GLSL you are using, but you can check section 4.3.4 of the GLSL 3.30 specification .

+2


source


No, because there is no sane way to do this for anything other than the noop geometry shader, and if your geometry shader does nothing for the geometry, why is it included in the first place?



In general, a geometry shader takes a number of vertices as input and produces a (different) number of vertices as output. So which input vertices (es) should be mapped to which output vertex (es) "automatically"?

+2


source







All Articles