Although I haven't tried to implement the translations yet I am quite concerned that nothing is drawn on the screen now I have implemented the new shader code (although it compiles correctly). I am using the following code for drawing.
Code: Select all
void Draw(void)
{
update_keys(); //Start listening for keyboard events.
glViewport(0, 0, state->render_width, state->render_height);
glClear(GL_COLOR_BUFFER_BIT);
shader_select(shader); //Make the shaders program current.
glLineWidth(3.0f);
glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, 0, ship );
glEnableVertexAttribArray( 0 );
glDrawArrays( GL_LINES, 0, 4 );
}
and the following shader code:
Code: Select all
uniform mat4 u_mvpMatrix;
uniform vec4 u_Translate;
attribute vec4 a_position;
void main()
{
vec4 posn;
posn = a_position + u_Translate;
gl_Position = u_mvpMatrix * posn;
}
and the fragment shader...
Code: Select all
precision mediump float;
void main()
{
gl_FragColor = vec4( 0.0, 1.0, 0.0, 1.0 );
}
I'm sorry but you might have to be a bit more specific to my code.
Thanks for all your help so far.