So, here I am trying to compile a geometry shader and my program crashes when I call glCompileShader with a geometry shader.
Am I doing something wrong? I’ve never tried using geometry shaders before, but it shouldn’t be complicated.
Should I use gl_PositionIn[n] on the geometry shader? How should I declare varyings?
I’ve got
attribute vec3 vertex;
out float a;
out vec3 b;
void main()
{
a = ...
b = ...
gl_Position = ...
}
on the vertex shader side of things, and on the geometry I have something like
in float a[4];
in vec3 b[4];
(...)
blabla = gl_PositionIn[0];
bla = a[1];
b = b[2];
I hope that’s enough to explain my problem… it wouldn’t be a problem if glCompileShader would return some errors instead of crashing.
Help, anyone? I couldn’t find any documentation about GS that uses strict OpenGL 3.x
From what I read in the specification I’m supposed to declare the geometry shader inputs as
in vec4 a[];
or
in vec4 a[gl_VerticesIn];
But the first way gives “array must be redeclared with a size before being indexed with a variable”, and the second way gives some error related to the index being wrong (3 instead of 4), but isn’t VerticesIn suposed to be set only at link time?
Since you’re using GL 3.1, which doesn’t have Geometry shaders as part of the core, you must be using the GL_ARB_geometry_shader extension. That means you need to enable the extension in your shader.
After sometime banging my head I ended up discovering that if I manually inlined the shader everything works. Maybe I should notify AMD drivers team to remind them that their OGL drivers still suck…