//鍵盤
void keyboard(unsigned char key, int x, int y)
{
if(key == 'q')angleX+=3;
if(key == 'e')angleX-=3;
glutPostRedisplay();
}
//打光
void myLight()
{
const GLfloat light_position[] = { 2.0f, 5.0f, -5.0f, 0.0f };
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
}
//滑鼠操作
void mouse(int button, int state, int x, int y)
{
printf("%d %d %d %d\n", button, state, x, y);
startX = x;
}
void motion(int x, int y)
{
printf("%d %d\n", x ,y);
angleX = x-startX;
glutPostRedisplay();
}
沒有留言:
張貼留言