PDA

View Full Version : rotation



zeroKelvin
08-15-2002, 07:14 PM
Hey people I'm having trouble, I was wondering is there a way to rotate an objects to a 90 degree with respects to the z-axis without rotating the x and y axis along with it. What I'm trying to do is rotate a block in my attempt to create tetris. so I'm rotating a block. Or do I just need to replot the block

Robbo
08-15-2002, 10:38 PM
A rotation by 90 is done as follows:

glRotatef ( 90.0f, 0.0f, 0.0f, 1.0f );

nexusone
08-16-2002, 04:24 AM
Your code should look something like this:

glPushMatrix();
glTranslatef(.....); location of piece.
glRotatef(90,0,0,1); Rotate Z-axis

draw_piece();

glPopMatrix();


Originally posted by zeroKelvin:
Hey people I'm having trouble, I was wondering is there a way to rotate an objects to a 90 degree with respects to the z-axis without rotating the x and y axis along with it. What I'm trying to do is rotate a block in my attempt to create tetris. so I'm rotating a block. Or do I just need to replot the block