Hey everyone, I'm having a bit of an issue with shader's in JOGL 2 for Java (JRE 1.7) and I'm hoping you can help. I have an interleaved and un-indexed VBO containing 3 floats per position axis and 3 floats per colour component, I'm able to draw 4 quads absolutely fine if I use the traditional methods for setting up the projection matrix (i.e. glMatrixMode, glLoadIdentity, glOrtho2D).
When I switch to using my own shader however everything draws fine projection wise, but I am unable to figure out how to pass the vertex colour from vert to frag shaders. So far I have tried various combinations switching between varying and in/out statements to no avail, I am sure I am just missing some syntactical knowledge here and would appreciate if someone could point me in the right direction.
Here is the fragment shader I am using:
in vec3 diffuse;
void main() {
gl_FragColor = vec4(diffuse, 1.0);
}
And here is the vertex shader I am using:
uniform mat4 projMatrix;
in vec3 position;
in vec3 color;
out vec3 diffuse;
void main() {
gl_Position = projMatrix * vec4(position.xyz, 1.0);
diffuse = vec3(1,1,1);
// diffuse = color;
}
Notice the commented out line of code, if I uncomment it and remove the line above the quads I am drawing change from opaque white to transparent (I've made sure by changing the background clear colour). Again I am sure this is just a lack of knowledge on my part but I've been going crazy trying to solve this all day so thanks in advance to anyone who can help me out.
Aimee