Glsl goes through a geometric shader issue

At this moment, I have a working vertex and fragment shader. If I completely remove my geometry shader, then I get the expected cube with flowers at each vertex. But when you add a geometric shader, geometry does not appear at all.

Vertex Shader:

#version 330 core layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 1) in vec3 vertexColor; out VertexData { vec3 color; } vertex; uniform mat4 MVP; void main(){ gl_Position = MVP * vec4(vertexPosition_modelspace,1); vertex.color = vertexColor; } 

Geometric Shader:

 #version 330 precision highp float; in VertexData { vec3 color; } vertex[]; out vec3 fragmentColor; layout (triangles) in; layout (triangle_strip) out; layout (max_vertices = 3) out; void main(void) { for (int i = 0; i > gl_in.length(); i++) { gl_Position = gl_in[i].gl_Position; fragmentColor = vertex[i].color; EmitVertex(); } EndPrimitive(); } 

Fragment Shader:

 #version 330 core in vec3 fragmentColor; out vec3 color; void main(){ color = fragmentColor; } 

My graphics card supports OpenGL 3.3 from what I can say. And as I said. It works without the Geometry shader. As data, I pass two GLfloat arrays, each of which corresponds to a vertex or vertex color.

+4
source share
1 answer
 for (int i = 0; i > gl_in.length(); i++) //note the '>' 

This loop condition will be false from the start, so you will never radiate any vertices. What you most likely had in mind is i < gl_in.length() .

+6
source

All Articles