Magnificence
04-30-2011, 02:39 PM
So I constructed my engine with OpenGL 1.1+. I did this to make it a little easier for me to get my matrices straight. Now that I think I have, I'm working on the OpenGL 3.0+ implementation, but apparantly my scene remains black (background color). I want to know what's wrong with my code. First, lets take a look at my vertex and fragment shaders:
Vertex:
#version 130
uniform mat4 model_matrix;
uniform mat4 view_matrix;
uniform mat4 projection_matrix;
in vec3 a_Vertex;
out vec4 color_output;
void main()
{
vec4 pos = model_matrix * vec4( a_Vertex, 1.0 );
pos = view_matrix * pos;
gl_Position = projection_matrix * pos;
color_output = vec4( 1.0, 1.0, 1.0, 1.0 );
}
I'm passing the color white to the fragment shader because I want to implement the textures a little later, for now, I just want to be able to load models.
So model_matrix is the matrix that positions every model to be drawn and view_matrix positions the 'camera'. In my OpenGL 1.1 implementation, I would:
Push the view matrix For each model:
Push the model matrix
Pop the model matrix
Pop the view matrix
I hope I'm getting the same effect with what I'm doing right now in my vertex shader.
Fragment:
#version 130
in vec4 color_input;
out vec4 color_output;
void main()
{
color_output = color_input;
}
There are now compile errors and I'm convinced I don't do anything else that should fail because I don't get any access violations (segmentation fault).
Any help would be appreciated, thanks.
Vertex:
#version 130
uniform mat4 model_matrix;
uniform mat4 view_matrix;
uniform mat4 projection_matrix;
in vec3 a_Vertex;
out vec4 color_output;
void main()
{
vec4 pos = model_matrix * vec4( a_Vertex, 1.0 );
pos = view_matrix * pos;
gl_Position = projection_matrix * pos;
color_output = vec4( 1.0, 1.0, 1.0, 1.0 );
}
I'm passing the color white to the fragment shader because I want to implement the textures a little later, for now, I just want to be able to load models.
So model_matrix is the matrix that positions every model to be drawn and view_matrix positions the 'camera'. In my OpenGL 1.1 implementation, I would:
Push the view matrix For each model:
Push the model matrix
Pop the model matrix
Pop the view matrix
I hope I'm getting the same effect with what I'm doing right now in my vertex shader.
Fragment:
#version 130
in vec4 color_input;
out vec4 color_output;
void main()
{
color_output = color_input;
}
There are now compile errors and I'm convinced I don't do anything else that should fail because I don't get any access violations (segmentation fault).
Any help would be appreciated, thanks.