How to pass generic attrib to geometry shader?

Hi
I have a user defined attribute vec3 v1, and I’d like to pass it to geometry shader. It doesn’t like built-in attributes gl_Position becomes gl_PositionIn[*] in geometry shader, what does v1 translated in geometry shader?

In GL2 you need to add the “in” qualifier to your inputs.
varying in vec3 foo;
varying out vec3 bar;

In GL3 you drop the varying and it’s just
in vec3 foo;
out vec3 bar;

so assuming I have an attrib v1, and geometry input is Points output is Triangles, should I write as
vert:
attribute vec4 v1;
varying out vec4 bar;
void main (){
bar = v1;
....

geom:
varying in vec4 bar[];
void main(){
// I assume bar[0] to be v1;
...

It seems doesn’t work @.@

I have solve the problem, it works OK
thank u

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.