Skip to main content
gamedev.net
🔒 Locked

Getting New Coordinates

Started by dachande May 25, 2002 at 2:58 PM 1 replies 250+ views
Original Post
dachande
dachande
Hey, I''m looking for a way to get my current OpenGL coordinates after doing a few rotations and translations. I would be grateful for any assitance with this: Example, I glLoadIdentity(), to start from the.. err.. start. I then glRotate around the Y axis by 25 degrees. Finally I glTranslate in to the screen by 32. Where am I? How can I retrieve the coordinates of my current position, so next time instead of rotating and translating I can simple translate to the position right away. I would be very thankful for an answer to this question, Thanks in advance, Dachande
uNiQue0815
uNiQue0815
i don''t really know... never checked them out... didn''t even read the description...
but maybe...

gluProject() / gluUnproject()

... can help you ?!?

don''t really know... just a guess...

-----------------------------------------

if you only need your position & "view direction", don''t you already have it in your modelview matrix, when your rotations are done ? you could save the whole matrix & reload it again...

maybe you could check this out !
invective
invective
You just have to multiply your starting point by the transformation matrices, or the concatenated transformation matrix, as openGL does.

If you don''t know how to do this, see:
http://skal.planet-d.net/demo/matrixfaq.htm

If you are too lazy to multiply the matrices together, you can also just get the concatenated MODELVIEW matrix from openGL with glGetFloatfv and multiply your point by this matrix. There is no vector or matrix library in openGL, so write your own or use the D3DX math library that comes with directX (you don''t have to use the rest of directX to use the math lib).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.