I am trying to add some shaders to my old OpenGL program, which draws a lot of GL_POINTS and some GL_LINES.
I created these two shaders:
Vertex shader:
void main() { vec4 v = vec4(gl_Vertex); vz = vz + sin(vx*vx + vy*vy)/10.0; gl_Position = gl_ModelViewProjectionMatrix * v; }
Fragment Shader:
#version 120 void main() { vec4 myOutputColor = gl_Color; gl_FragColor = myOutputColor;
These two shaders compile and link without any problems. And the vertex shader works fine, I see that GL_POINTS is shifted using this sin in the vertex shader. But the problem is that I can only see GL_POINTS and GL_LINES if the background color is not black, because all the points and lines are highlighted in black. It seems that all colors specified with glColor3f in the rendering code are ignored. If I uncomment the commented line in my fragment shader, I can make all lines and dots red, but should gl_Color match the color set with glColor3f for each point?
Is there anything else in my OpenGL code that can cause this behavior?
shader opengl glsl
ivans
source share