如何在openGL中旋转特定对象?

sna*_*ile 12 graphics opengl-es rotation

我在屏幕上有一些对象,并且只想旋转其中一个.我尝试使用glRotatef(...)函数,但结果是glRotatef(...)旋转我的所有对象(旋转相机,也许?).我怎么才能只旋转一个?

我使用openGL ES 1.1

Jay*_*nek 24

只有在绘制您感兴趣的几何体时,才需要旋转才有效.

... draw stuff ...
glPushMatrix();
glRotatef(angle, 0, 1, 0);
... draw rotated stuff ...
glPopMatrix();
... draw more stuff ...
Run Code Online (Sandbox Code Playgroud)