ei05tbe
08-07-2010, 12:14 PM
I am trying to create a simple shader. Can you tell me why gl_FragData[2] = vec4(1,0,0,0) works as expected, but gl_FragData[2] = gl_Color don't. When using gl_Color nothing(except objects rendered whit another shader program ) shows up on the screen.
1 varying vec3 position, normal;
2
3 void main(void) {
4 position = vec3(gl_ModelViewMatrix * gl_Vertex);
5 normal = gl_NormalMatrix * gl_Normal;
6 gl_Position = ftransform();
7 }
1 #extension GL_ARB_draw_buffers : enable
2
3 varying vec3 position, normal;
4
5 void main(void) {
6 gl_FragData[0] = vec4(position.xyz, 0.0);
7 gl_FragData[1] = vec4(normalize(normal.xyz), 0.0);
8 gl_FragData[2] = gl_Color;//vec4(1,0,0,0); //wont the current color;
9 }
1 varying vec3 position, normal;
2
3 void main(void) {
4 position = vec3(gl_ModelViewMatrix * gl_Vertex);
5 normal = gl_NormalMatrix * gl_Normal;
6 gl_Position = ftransform();
7 }
1 #extension GL_ARB_draw_buffers : enable
2
3 varying vec3 position, normal;
4
5 void main(void) {
6 gl_FragData[0] = vec4(position.xyz, 0.0);
7 gl_FragData[1] = vec4(normalize(normal.xyz), 0.0);
8 gl_FragData[2] = gl_Color;//vec4(1,0,0,0); //wont the current color;
9 }