@Collin_Schupman wrote:
I have a VboMesh I'm drawing with some shaders using OpenGL 2.X:
.vert
#version 120uniform float rotation = 1.0; mat4 rotationMatrix(vec3 axis, float angle) { axis = normalize(axis); float s = sin(angle); float c = cos(angle); float oc = 1.0 - c; return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0, oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0, oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0, 0.0, 0.0, 0.0, 1.0); } void main() { vec3 axis = vec3(1.0, 0.0, 0.0); gl_TexCoord[0] = gl_MultiTexCoord0; vec4 pos = gl_ProjectionMatrix * gl_ModelViewMatrix * rotationMatrix(axis, rotation*10.0) * gl_Vertex; gl_Position = pos; vec4 col = gl_Color; gl_FrontColor = col; }.frag
#version 120void main() { gl_FragColor = gl_Color; }Here's the C++ code where the shader is being used (in draw()):
shader.begin(); shader.setUniform1f("rotation", rotateAccelX); ofPushMatrix(); ofTranslate(ofGetWidth()/2, ofGetHeight()/2); vboMesh.drawVertices(); ofPopMatrix(); shader.end();I'm trying to run this in 3.3 and onwards but I can seem to get the colors to draw at all, I just get a blank screen with no errors, here are the shaders I've tried to use:
.vert
#version 330layout (location = 0) in vec4 position; layout (location = 1) in vec4 color; smooth out vec4 theColor; void main() { gl_Position = position; theColor = color; }.frag
#version 330smooth in vec4 theColor; out vec4 outputColor; void main() { outputColor = theColor; }Just getting a blank screen. How can I fix/rewrite my previous shaders to work with OpenGL 3.3?
Posts: 1
Participants: 1