0
我想在OpenGL 2.0中創建一個雪人。我想旋轉整個形狀,但每次運行程序都不起作用。在OpenGL中旋轉的多個對象
glPushMatrix();
//bottom sphere
glTranslated(tranX,tranY-2,tranZ);
glRotated(rotX,1,0,0);
glRotated(rotY,0,1,0);
glRotated(rotZ,0,0,1);
glScaled(scaX,scaY,scaZ);
glColor3f(1.1,.7,.99);
glutSolidSphere(1.5,30,30);
//middle sphere
glTranslated(tranX,tranY+2.3,tranZ+8);
glRotated(rotX,1,0,0);
glRotated(rotY,0,1,0);
glRotated(rotZ,0,0,1);
glScaled(scaX,scaY,scaZ);
glColor3f(1.1,.7,.99);
glutSolidSphere(1.3,30,30);
//top sphere
glTranslated(tranX,tranY+2,tranZ+10);
glRotated(rotX,1,0,0);
glRotated(rotY,0,1,0);
glRotated(rotZ,0,0,1);
glScaled(scaX,scaY,scaZ);
glColor3f(1.1,.7,.99);
glutSolidSphere(1,30,30);
glPopMatrix();
你能比'不行'更具體嗎? – icktoofay 2013-03-03 03:09:44
答案已經給出,但我想添加一個建議:您可以嘗試避免舊的固定功能管道,並使用glm(http://glm.g-truc.net/)來構建自己的小場景圖發動機。 – dinony 2013-05-16 16:10:15