PDA

View Full Version : Shader not liking my matrices



Matt Clark
04-26-2011, 10:35 AM
I have recently been working on shifting over to handling my matrix controls myself, so that my engine will be ready to shift over to a 4.0+ context. I have tried all kinds of matrix calcs and nothing seems to work with my shader(nothing on screen except for FPS counter unless I switch back to fixed-pipe, or if I switch the vs to set gl_Position = vec4(position,1.0);). Even when I grab the values that OpenGL normally sets and put them into it I get the same. Would you mind giving these shaders a once over to see if anything stands out.

Thanks,
-Matt

Vertex Shader:

#version 120
#extension GL_ARB_draw_buffers : require
#extension GL_EXT_gpu_shader4 : require

//layout(location = 0) in vec3 position;
attribute vec3 position;
attribute vec3 normal;
attribute vec3 tangent;
attribute vec2 texcoord;
attribute vec4 color;

uniform mat4 ModelView;
uniform mat4 Projection;

void main()
{
mat4 mvp = Projection*ModelView;
gl_Position = mvp * vec4(position,1.0);
//gl_Position = vec4(position,1.0);
}

Fragment Shader:

#version 120
#extension GL_ARB_draw_buffers : require
#extension GL_EXT_gpu_shader4 : require

uniform float slider;

void main()
{
vec4 diffuse = vec4(vec3(slider),1.0);

gl_FragColor = diffuse;
}

Side note: was using Geometry Shaders, but couldn't even get it to display with gl_Position = vec4(position,1.0) with the GS, so I disabled them till I get this working.

V-man
04-26-2011, 03:13 PM
Probably your matrices are bad.
See my sig. It is a lib that has functions that prepare all GL matrices.

Matt Clark
04-27-2011, 07:41 AM
Thanks for your input! I'll take a look at your code and see if I can't figure out what's wrong with mine vs. yours^^ ...Hopefully that will get this settled. Thanks again.