# how can i get the vertex after rotation?

I set the GL_MODELVIEW matrix:
glMatixMode(GL_MODELVIEW);
and there is a vertex(x1, y1, z1), after some rotation, how can i get the new vertex’s coord without extro calculation? Is there an interface which can be used?

you can do it like in this way
GLfloat mat[16];//Global
make your own function(like MulMat) which multiply matrix with 3 Co-Ordinates with taking care of OpenGL Matrix Order

glPushMatrix();
Rotatef(same argument as applied for vertex data);
glGetFloatv(GL_MODELVIEW_MATRIX,mat);
glPopMatrix();
glPushMatrix();
glPopMatrix();
and then
MulMat(x1,y1,z1,mat);

http://www.gamedev.net/topic/472383-math-library-for-opengl/

“MulMat” is a standard API?
I do it like this:
glRotatef(2.0f, m_fr[0], m_fr[1], m_fr[2]);
glGetFloatv(GL_MODLEVIEW, modalView);
x = modalView[0] * m_fv[0] + modalView[1] * m_fv[1] + modalView[2] * m_fv[2] + modalView[3];
y = modalView[4] * m_fv[0] + modalView[5] * m_fv[1] + modalView[6] * m_fv[2] + modalView[7];
z = modalView[8] * m_fv[0] + modalView[9] * m_fv[1] + modalView[10] * m_fv[2] + modalView[11];

m_fv[0] = x;
m_fv[1] = y;
m_fv[2] = z;

Is it right?

not it is a function and definition is depends on you
better to say vecXmat
take in this way

``````
void GetCol(float Mat[16],float (&Res)[4],int c)
{
assert(c<=4);
for(int r=0;r<4;r++)
{
Res[r] = Mat[r+4*c];
}
}

void VecxMat(float Mat[16],float Vec[4],float (&Res)[4])
{
float Col[4];
for(int i=0; i<4;i++)
{GetCol(Mat,Col,i);
Res[i] = Vec[0]*Col[0]+Vec[1]*Col[1]+Vec[2]*Col[2]+Vec[3]*Col[3];
}

}

``````

use any algorithm and method
but the output must show
ranging
-x to x
and for y and z
and also as from your code
you are changing m_fv
try to do not put glRotate again
see whether output is of rotating or not