Hello all

I’m trying to adapt the lines based geometryShaderExample from #version 120 to #version 330 as I’m working with openGL 4,1. I’ve kept things as unchanged as possible from the example… At the minute I don’t get any obvious errors thrown on running, but can’t see any results.

Can anyone give any pointers for what I have wrong, or point me to any version 330 examples of geometry shaders (ideally as simple as possible) ?

My shaders are as follows:

vertex shader:

```
#version 330
uniform mat4 modelViewProjectionMatrix;
in vec4 texcoord;
void main(){
gl_Position = modelViewProjectionMatrix*texcoord;
}
```

frag shader:

```
#version 330
out vec4 FragColor;
void main(){
FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
```

and finally, in the geometry shader:

```
#version 330
uniform float thickness;
uniform vec3 lightDir;
layout (lines) in;
layout (triangle_strip, max_vertices = 4) out;
void main() {
vec3 p0 = gl_in[0].gl_Position.xyz;
vec3 p1 = gl_in[1].gl_Position.xyz;
vec3 up = vec3(0, 0, 1); // arbitrary up vector
vec3 dir = normalize(p1 - p0); // normalized direction vector from p0 to p1
vec3 right = normalize(cross(dir, up)); // right vector
vec3 norm = cross(right, dir);
float fColMult = abs(dot(norm, lightDir));
vec4 colMult = vec4(fColMult, fColMult, fColMult, 1.0);
right *= thickness;
gl_Position = vec4(p0 - right, 1.0);
EmitVertex();
gl_Position = vec4(p0 + right, 1.0);
EmitVertex();
gl_Position = vec4(p1 - right, 1.0);
EmitVertex();
gl_Position = vec4(p1 + right, 1.0);
EmitVertex();
}
```

ofApp etc is pretty much exactly the same.

Can anyone help?

Thanks!

S