PDA

View Full Version : OpenGL coordinates: im confused!



kaysoft
09-25-2002, 03:30 AM
Hi everyone, I used to be a D3D guy but I changed to GL recently. The problem I have now is weird to me. Ok, let me describe it:
Im experimenting with the glVertex3* functions, but when I add values to the Z vector (1,2,3, etc, positive ones), the triangle goes back instead of forward! Then, I thought I could make a camera system with gluLookAt. Ok, I did that, but the coordinates are reversed again. I can't describe the problem well, because I was using screen coordinates in Direct3D and this is world space. Any ideas/help for me?Thanks

dabeav
09-25-2002, 03:41 AM
Im not sure about D3D, but in OpenGL, -Z values go into the screen, and possitive Z values point out of the screen to your eyes.

Also I dont recomend using glulookat, Since the world never actualy moves, just the possition relative to you, i simply would move (everything) in the reverse of your desired move, this way the "camera" will appear to move forward.

kaysoft
09-25-2002, 03:55 AM
Oh, so I should do the reverse thing as I did with D3D. But is there a way to use positive Z values to move in the screen and negative to move out?

Deiussum
09-25-2002, 04:26 AM
I did some experimenting with D3D8 awhile back and was annoyed that in D3D positive Z instead of negative was going into the screen! http://www.opengl.org/discussion_boards/ubb/smile.gif

One other thing that annoyed me about D3D that you might notice different about OGL is that D3D seemed to reverse the order it multiplied the matrices. Or maybe that was just the D3DX stuff that did that. I don't rmember for sure. I just remember I had to multiply matrices the opposite order than what I was used to.


[This message has been edited by Deiussum (edited 09-25-2002).]

kaysoft
09-25-2002, 05:52 AM
Ok, I will get used to the new Z values http://www.opengl.org/discussion_boards/ubb/smile.gif