Thanks for your answer, but it doesn't seem to be the issue. OpenGl is expecting the matrix in column-major order, so
cameraBuffer.put(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, -1.0, 0.0,
0.0, 0.0, 1.0, 1.0);
would represent this Matrix:
[[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 1.0]]
Or am I wrong?
This is how this matrix is computed in my code:
public Matrix4f getProjectionMatrix() {
Matrix4f matrix = new Matrix4f();
matrix.m00 = 2 / (right - left);
matrix.m30 = -(right + left) / (right - left);
matrix.m11 = 2 / (top - bottom);
matrix.m31 = -(top + bottom) / (top - bottom);
matrix.m22 = -2 / (zFar - zNear);
matrix.m32 = -(zFar + zNear) / (zFar - zNear);
return matrix;
}
That is how I am sending it to OpenGL:
FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
matrix.store(buffer);
buffer.flip();
glUniformMatrix4(glGetUniformLocation(program, "camera"), false, cameraBuffer);
I hope that helps, but I don't think the issue is in this part...