PDA

View Full Version : Getting axis coordinates



neutrino17
05-26-2008, 09:45 AM
In my graphics scene I have a drawn coordinate system (let it be XYZ) that I want to be able to rotate around imaginary axes bounded to camera. XYZ is drawn at the origin and then rotated. So if I specify (1.0, 0.0, 0.0) as vector coordinates to glRotatef call, it will rotate the scene around the current XYZ coordinate. As I understand I have to multiply (1.0, 0.0, 0.0) by inverse projection matrix and then multiply the result by inverse modelview matrix to get coordinates of the axis that coincide with screen X axis. Is that right?

fldz
05-27-2008, 09:34 PM
I'm a n00b & not sure I understand the question, but what the hell.

Something I noticed trying to build a skeleton. No matter how many nested push/pop matrix, you can read the absolute coords of any joint directly from the MODELVIEW_MATRIX.

glGetFloatv,GL_MODELVIEW_MATRIX,offset matrix1

offset matrix1 + 12(dwords) will be float X
offset matrix1 + 13 Y
offset matrix1 + 14 Z

Maybe that's relevant.