Hey,
i tried to calculate a model-view-projection matrix for my 330 OpenGL shaders, but the matrix won’t work at all…
I googled too, but i didn’t find something. Just a small example with the GLM-Math library, but this doesn’t help me.
Here is how i calculated the mvp matrix (in LWJGL):
glGetFloat(GL_PROJECTION_MATRIX, projection);
glGetFloat(GL_MODELVIEW_MATRIX, modelview);
Matrix4f mvp = new Matrix4f(); //Load mvp matrix as identity matrix.
Matrix4f mm = new Matrix4f().load(modelview); //Load the model view matrix from the FloatBuffer containing the model view matrix.
Matrix4f pm = new Matrix4f().load(projection); //Load the projection matrix from the FloatBuffer containing the projection matrix.
mvp.multLocal(mm).multLocal(pm);
At all my calculation looks like:
Read the projection matrix.
Read the modelview matrix.
Load a matrix as identity matrix.
MVP = identity * projection * modelview.
Hopefully someone can help me!