views:

50

answers:

2

I have some objects on the screen and would like to rotate only one of them. I tried using the glRotatef(...) function but turns out glRotatef(...) rotates all my objects (rotates the camera, maybe?). How can I rotate only one?

I use openGL ES 1.1

+4  A: 

You need the rotation to be in effect only when the geometry you're interested in is being drawn.

... draw stuff ...
glPushMatrix();
glRotatef(angle, 0, 1, 0);
... draw rotated stuff ...
glPopMatrix();
... draw more stuff ...
Jay Kominek
+2  A: 

Tutorial #4 from NeHe shows how to do that precisely.

Also, you might want to take a look at this:

http://stackoverflow.com/questions/23918/opengl-rotation

karlphillip