# Thread: Get Coordinates of Transformed Geometry

1. ## Get Coordinates of Transformed Geometry

Get Coordinates of Transformed Geometry?

Example:
glPushMatrix();
glRotatef(55,1.0,0.0,0.0);
glBegin(GL_POINTS);
glVertex3f(x,y,z);
glEnd();
glPopMatrix();
So how can I get the Coordinates of my rotated vertex? is this possible or do i have to calculate the position myself (would be very slow)?

thank you H.Stony

3. ## Re: Get Coordinates of Transformed Geometry

sorry..i found nothing really useful
i found something about "feedback mode". are there tutorials on it?

thanks

4. ## Re: Get Coordinates of Transformed Geometry

I'm not sure, but maybe if you multiply the coordinates of the vertex by the rotated modelview matrix...

5. ## Re: Get Coordinates of Transformed Geometry

that was also my first idea: which are the elements in the matrix to multiplicate? the last row? ....but
i found a sgi example. in the example they use the feedback mode but i didn't find tutorials on it - only the example is hard to understand.

6. ## Re: Get Coordinates of Transformed Geometry

First retrieve the current modelview matrix:

float mv[16];
glGetFloatv(GL_MODELVIEW_MATRIX, mv);

Then do the following to transform your vertex:

float xp = mv[0] * x + mv[4] * y + mv[8] * z + mv[12];
float yp = mv[1] * x + mv[5] * y + mv[9] * z + mv[13];
float zp = mv[2] * x + mv[6] * y + mv[10] * z + mv[14];
float wp = mv[3] * x + mv[7] * y + mv[11] * z + mv[15];

xp /= wp;
yp /= wp;
zp /= wp;

/A.B.

7. ## Re: Get Coordinates of Transformed Geometry

thank you

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•