I am porting GLU gluUnproject method to the modern OpenGL.I generally understand the algorithm behind it, but my question is why do we need model-view matrix?Can it be just view matrix?We unproject screen coordinates into the world space, so why do I need to supply also some object's model matrix (as a part of model view)?Or maybe I misunderstand how to use the method?I never really used fixed pipeline.
0
votes
Do you mean the projection matrix by view matrix?
– Nobody moving away from SE
I mean that in the fixed pipeline example of gluUnproject usage, GL_MODELVIEW is queried .Does it contain also some 3d object's model matrix?
– Michael IV
The modelview matrix contains the transformation of the model into the worldspace and from the worldspace into eye space, but not the projection.
– Nobody moving away from SE
I know that it doesn't contain the projection.But if I don't reference any particular object,can the model part be just an identity?
– Michael IV
I am not sure if I understood you correctly, but I will answer to what I think you asked: The Model matrix can be an identity matrix, which means that the model and world space are the same.
– Nobody moving away from SE
1 Answers
1
votes
gluUnproject is usually described as transfroming coordinates from screen space (back) to object space. However, you can always use any matrices you like to get into some other space, so just using the view matrix here would give get you the world space values you seem to care about. The fixed function pipeline of GL never did use a world space explicitely, and always worked directly on the comopsition of the model and the view matrix.