glPushMatrix();
glTranslatef();
glRotatef();
glTranslatef();
glPopMatrix();
#include<GL/glut.h>
float angle=0;
void drawbody()
{
glPushMatrix();
glScalef(1, 0.5, 0.5);
glutSolidCube(1);
glPopMatrix();
}
void drawArm()
{
glPushMatrix();
glTranslatef(0.6, 0.2, 0);
glRotatef(angle,0,0,1);
glTranslatef(0.3,0,0);
glPopMatrix();
glFlush();
}
void timer(int t)
{
glutTimerFunc(20, timer ,t+1);
angle++;
glutPostRedisplay();
}
int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutCreateWindow("h-w test");
glutDisplayFunc(display);
glutTimerFunc(20, timer, 0);
glutMainLoop();
}
沒有留言:
張貼留言