Im new to the modern OpenGL. Ive set up the view matrix, and it worked fine. Then I added a basic projection matrix. This one:

GLfloat projection_matrix[16] = { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 };

....and it worked fine. I tried to use a proper matrix and its not working. The camera looks into the wrong direction and the movement and rotation is mirrored:

(I use 90 deg perspective angle and 1.0 aspect ratio to keep it simple)

float n = 0.5, //near f = 100.0, //far w2 = 0.5, //width / 2 h2 = 0.5; //height / 2 GLfloat projection_matrix[16] = { n/w2, 0.0, 0.0, 0.0, 0.0, n/h2, 0.0, 0.0, 0.0, 0.0, -((f+n)/(f-n)), -1.0, 0.0, 0.0, -(2*f*n)/(f-n), 0.0 };

I basically copied this from the OpenGL Programming Guide 8, so I dont get why is this not working. Any help would be appreciated.

Here is the shader source BTW:

#version 330 core layout(location = 0) in vec3 vertex_pos; layout(location = 1) in vec3 vertex_color; uniform mat4 V_trans; uniform mat4 V_rot; uniform mat4 P; flat out vec4 color_VOUT; void main(){ color_VOUT = vec4( vertex_color, 1); vec4 pos_H = vec4( vertex_pos, 1); gl_Position = P * (V_rot * V_trans) * pos_H; }