GLSL Geometry shader and generic vertex attributes?

The geometry shader doesn't get attributes. The vertex shader gets attribute s and puts out varying s (speaking in the old syntax). These can then be read in the geometry shader, but as an array, as one geometry shader invocation follows multiple vertex shader invocations.

Something like this: vertex shader: attribute float nodesize; varying float vNodesize; void main() { ... vNodesize = nodesize; ... } geometry shader: varying float vNodesize; void main() { ...vNodesizei... } The names are arbitrary, but of course the names of the varyings have to match in both shaders. I hope you didn't just mess up the terms vertex shader and geometry shader.

The geometry shader doesn't get attributes. The vertex shader gets attributes and puts out varyings (speaking in the old syntax). These can then be read in the geometry shader, but as an array, as one geometry shader invocation follows multiple vertex shader invocations.

Something like this: vertex shader: attribute float nodesize; varying float vNodesize; void main() { ... vNodesize = nodesize; ... } geometry shader: varying float vNodesize; void main() { ...vNodesizei... } The names are arbitrary, but of course the names of the varyings have to match in both shaders. I hope you didn't just mess up the terms vertex shader and geometry shader.

– kamziro Jun 30 at 14:38 @kamziro If the I has no meaning (or is always 0), then you should rethink if you really need a geometry shader. Inform yourself what a geometry shader really does, it is only used in rather special cases. Maybe you messed up the terms vertex shader and geometry shader.

– Christian Rau Jun 30 at 14:44 I've been using the geometry shader to emit a cube from a single vertex. But the input from a single pass of the geometry shader is still only a vertex, which means I is always 0.. am I right? – kamziro Jun 30 at 15:09 @kamziro Ok, then the geometry shader is a good idea and I is indeed just 0 (so you don't need an "i").

But you still need an array for the varying, as the geometry shader syntax demands it. – Christian Rau Jun 30 at 16:33 @kamziro It may be, that when you are using the old syntax, you need to give the varying array a specific size (1 in your case) and cannot just use , but I'm not sure about that, as I have not much experience with geometry shaders. – Christian Rau Jun 30 at 16:37.

From the Open GL language specification (4.10.6) A single invocation of the geometry shader executable on the geometry processor will operate on a declared input primitive with a fixed number of vertices. This single invocation can emit a variable number of vertices that are assembled into primitives of a declared output primitive type and passed to subsequent pipeline stages. This means that you need to specify on witch kind of primitive (point, line, trianle, quad) the geometry assumes.

If I understand you correctly you want the geom shader to emit a cube for each vertex. So you should set the geometry input type to point.As a reslult the geom shader code should start like this: varying float vNodesize; void main() { ...vNodesizei... } Where I = 0 for points =1 for lines and so on.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions