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

There are several other threads talking about that.

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

thanks

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

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.

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.

thank you