PDA

View Full Version : construct rotation matrix



huangzl99
11-10-2001, 04:49 PM
hi, I construct the rotation matrix with opengl, like this:

main(){
double angle=90.0, temp[16],aixs[3];
axis[0]=0;
axis[1]=1;
axis[2]=0;

glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotated(angle,axis[0],axis[1],axis[2]);
glGetDoublev(GL_MODELVIEW_MATRIX,temp);
//temp is the rotation/trans matrix
....
}

but when I run it, temp simply dose not been changed by the opengl, what wrong with this code? it there an initialization to opengl?


need help, thanks you.

chowe6685
11-10-2001, 05:03 PM
Well first of all, I'm not sure why you are doing this to get a rotation matrix, wouldn't it just be easier to make one yourself, there are tons of documents about them online, but try loading the identity matrix before you rotate it

Tron
11-10-2001, 07:33 PM
@chowe6685:
there IS a LoadIdentity...

@huangzl99:
is that the whole code?
you MUST have an active OpenGL rendering context to issue ANY OpenGL commands (even glGetString)