# Camera view/projection issue

I made a simple OpenGL program but I can figure out why the camera is not working, here it's a little fragment of the Camera class:

public Matrix4f getView() { // initializes the view matrix
return new Matrix4f().lookAt(
new Vector3f(0f, 0f, 1f), // camera position at 0,0,1
new Vector3f(0f, 0f, 0f), // camera target at 0,0,0
new Vector3f(0f, 1f, 0f)); // up axis set to "worldUp" (0,1,0)
}

public Matrix4f getProjection() {
return new Matrix4f().perspective(
(float) Math.toRadians(fieldOfView), // the fov has a value between 0f and 180f, by default I set it to 90°
viewportAspectRatio, // the aspect ratio is equal to 1024 / 960 (screen height / screen width)... even if I've not understood what is it...
0.1f, 1000f); // I've not really understood what near and far planes are...
}

public Matrix4f getMatrix() { // with this function I obtain the final camera matrix
return getView().mul(getProjection());
}


And it's how I handle the camera Matrix in GLSL, created using camera.getMatrix():

gl_Position = camera * model * vec4(position, 1.0);


Without the camera all is fine: here's the program running using gl_Position = model * vec4(position, 1.0);:

(Yeah, it's a cube)

But using the camera in the way I showed you before, increasing the FOV, I get this:

Could anyone look at my code and tell me where I'm wrong? I would be really happy... D:

• Are your vertices defined in clip-space? – Jon Mar 17 '16 at 6:30
• In clip-space? I think yes, look at the cube without camera, all seems fine. – lory Mar 17 '16 at 6:32
• That would be -1:1 components with model set to identity? – Jon Mar 17 '16 at 6:33
• I'm using modern opengl so i don't really know what identity is. With the VBO buffer i loaded correct vertices, i'm sure of that. With the model Matrix i Made a 'null' Matrix which has 1,1,1 of scale and 0,0,0 of translate. – lory Mar 17 '16 at 6:41
• Let just eliminate viewproj as a possible issue first. Please add the array of values produced by getMatrix to your answer and I'll compare them to my DX RH methods. – Jon Mar 17 '16 at 6:48

I solved, the problem was on getMatrix. Has Jon say I had to flip getView().mul(getProjection()) to obtain getProjection().mul(getView()). At first I though that this would not change anything but I was wrong. Thank you Jon!