0

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.

Michael IV
  • 11,016
  • 12
  • 92
  • 223

1 Answers1

1

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.

derhass
  • 43,833
  • 2
  • 57
  • 78
  • So,based on what you said, I can discard model part if it is world's default (identity)? – Michael IV Sep 19 '13 at 19:10
  • @MichaelIV: yes. the inverse of identity is still identity, so it does not matter if you use use V alone or assume M=I and use V*M as the modelview matrix. – derhass Sep 19 '13 at 19:18
  • Ok,now I get you.It is probably essential if the unprojection is happening in different spaces than the world.Thanks for the clarification. – Michael IV Sep 19 '13 at 19:32