the inner 2x2 matrix handles the scaling, the 3rd column handles the translation. after everything is projected its almost like having a large 2D plane. this matrix just moves along this plane and scales how big everything is (rather than scaling how big your view port is as is common in openGL, it moves the world around the camera not the camera itself).

Anyway. enjoy

"You have to want it more than you want to breath, then you will be successful"

gluUnproject() doesn't take the viewport matrix (there isn't actually any such thing as far as OpenGL is concerned), it takes the viewport parameters. ie the stuff you pass in glViewport(): x, y, width, height.

gluUnproject() doesn't take the viewport matrix (there isn't actually any such thing as far as OpenGL is concerned), it takes the viewport parameters. ie the stuff you pass in glViewport(): x, y, width, height.

First, the viewport transformation can be written as a matrix so there is actually such a thing. Second, he is using modern opengl and is probably trying to avoid glu calls since these calls tend to reduce freedom and control over the program. Ive never used the gluUnproject but if it doesn't take in the projection matrix as a parameter, then it probably assumes you are using the fixed function pipeline which he is not. All he is doing is multiplying the point on the window by the inverse of the viewport and the inverse of the projection. gluUnproject does the same thing in the background it just hides the matrix math from you.

"You have to want it more than you want to breath, then you will be successful"

Firstly I meant that "as far as OpenGL is concerned" there is no such thing. Ie OpenGl doesn't use a matrix. It could depending on the driver implementation but it would just be slower to use a matrix for such a consistent operation. It is always: times by a, add b. Otherwise your viewport matrix is quite right.

And jmguillemette said he is still using the gluUnproject() function he just needed a way to get the viewport.

Firstly I meant that "as far as OpenGL is concerned" there is no such thing. Ie OpenGl doesn't use a matrix. It could depending on the driver implementation but it would just be slower to use a matrix for such a consistent operation. It is always: times by a, add b. Otherwise your viewport matrix is quite right.

And jmguillemette said he is still using the gluUnproject() function he just needed a way to get the viewport.

Ah ok your right, looked up the gluUnproject method and what he was asking made a lot more sense.

"You have to want it more than you want to breath, then you will be successful"

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org