赞
踩
鼠标左键加速旋转,右键减速。
代码如下:
#include<gl/glut.h>
#include<math.h>
#include<windows.h>
#include<algorithm>
using namespace std;
float angle = 0;
float speed = 0.1;
void myDisplay()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //清除颜色缓存和深度缓存
glLoadIdentity(); //初始化坐标位置
/*
glTranslatef(); //平移
glScaled(); //缩放
glRotatef(); //旋转
*/
glTranslated(0, 0, -6);
glRotatef(angle, 0, 1, 0);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f);
glColor3f(

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。