本文介绍了如何在openGL中旋转特定对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在屏幕上有一些对象,我只想旋转其中一个.我尝试使用 glRotatef(...) 函数,但结果 glRotatef(...) 旋转了我所有的对象(旋转相机,也许?).如何只旋转一个?
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?
我使用 openGL ES 1.1
I use openGL ES 1.1
推荐答案
只有在绘制您感兴趣的几何图形时,您才需要使旋转生效.
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 ...
这篇关于如何在openGL中旋转特定对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!