cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

xernobyl
Journeyman III

OpenGL 3.* and Geometry Shaders

When I declare the shader inputs/varyings as "in vec3 a[];" I get an "array must be redeclared with a size before being indexed with a variable" error, and with "in vec3 a[gl_VerticesIn];" I get an array size mismatch (3 vertexes, triangles, when I want line adjacency, 4 vertexes).

What's the correct order to compile/assign the shaders to a program in OpenGL if I want to use Geometry Shaders?

Tags (2)
0 Likes
6 Replies
xernobyl
Journeyman III

OpenGL 3.* and Geometry Shaders

And if I use

in vec3 a[4];

glCompileShader(geometryshader) crashes. Since my other shaders (fragment and vertex) compile properly, should I complain to the drivers team, or is it written in the specification that the functions should crash if your shader code is that bad?

0 Likes
xernobyl
Journeyman III

OpenGL 3.* and Geometry Shaders

After some time banging my head I discovered that by manually inlining the code there are no more crashes and everything works.

0 Likes
frali
Staff
Staff

OpenGL 3.* and Geometry Shaders

If you specify the input layout, there will be no problem. Just like

#version 150

layout(triangles) in;

...

in vec4 a[];

0 Likes
frali
Staff
Staff

OpenGL 3.* and Geometry Shaders

In order to use the geometry shader, you need to specify the input layout and output layout first. There are two ways to specify it.

1. set it by application. It's required by arb geometry shader4. You'd better add "#extension GL_ARB_geometry_shader4: enable" in the shader.

2. set it in the shader as I suggested yesterday. It's required by glsl1.5.

#version 150

layout(triangles) in;

layout(triangle_strip, max_vertices = 6)out;

in vec3 a[];

The crash which is caused by the shader code will be fixed in an upcoming Cat Release driver.  

0 Likes
erwincoumans
Journeyman III

OpenGL 3.* and Geometry Shaders

 

Is there any working OpenGL geometry shader demo with source code for the latest ATI Radeon cards?

(using GL_ARB_geometry_shader4 or other)?

 

0 Likes
erwincoumans
Journeyman III

OpenGL 3.* and Geometry Shaders

 

Actually, I found this one to work http://nopper.tv/opengl_3_2.html

 

Another demo using geometry instancing is here:

http://rastergrid.com/blog/2010/02/instance-culling-using-geometry-shaders/

0 Likes