Skip to main content
gamedev.net
🔒 Locked

computing world coordinates

Started by XorMultiPleXus Jun 2, 2006 at 8:26 AM 1 replies 400+ views
Original Post
XorMultiPleXus
XorMultiPleXus
hi the question: lets have a point A, then apply som transforms (translate, rotate). I want to know what are the world coordinates of A? I know the math solution but i want to know how do i aquire this information in OGL. Example: glLoadIdentity(); glTranslatef(5,0,0); glTranslatef(0,5,0); glRotatef(90,1,1,0); glBegin... glVertex(0,0,0); //here i want to know the world coordinates of 0,0,0 .. glEnd... I know in math i have to first compute RA, R is the rotate matrix, and then T2R and then T1R (Ti are transformation matricies). But in openGL i dont know how do i get the matrix T1*T2*R. Thanks XorMultiPleXus
arbuckle911
arbuckle911

float mat[16];
glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0]);
This will load a matrix into the array. Pretend it's a 4*4 matrix in this order:

0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15

then multiply it by the 1x4 matrix of the very you want.

0 4 8 12 x
1 5 9 13 * y = (x,y,z,1) in world space.
2 6 10 14 z
3 7 11 15 1
XorMultiPleXus
XorMultiPleXus
thanks

i did it this way, but it did not work, i must did a bug

Topic Locked

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

Sign in to reply to this topic.