本文主要是介绍计算机图形学 -- 变换之旋转二 [鼠标操作],希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在上一次的旋转中加入鼠标的动作,
按左键加速,右键减速,中键停止
滚轮的动作文件中好像没有,总之没有找到,只有键的定义
稍后补上
#include<GL/glut.h>
#include<stdlib.h>
#pragma comment(linker,"/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
GLfloat rtri;
float add = 0.1f;void init()
{glClearColor(0.0f,0.0f,0.0f,0.0f);glShadeModel(GL_SMOOTH); //GL_FLAT和GL_SMOOTH在这里的区别很明显哟glEnable(GL_DEPTH_TEST);}void mydisplay()
{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();glTranslatef(0.0f,0.2f,-4.0f); glRotatef(rtri,0.0f,1.0f,0.0f); glBegin(GL_TRIANGLES);glColor3f(1.0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,0.0f);glColor3f(0.0f,1.0f,0.0f);glVertex3f(-1.0f,-1.0f,1.0f);glColor3f(0.0f,0.0f,1.0f);glVertex3f(1.0f,-1.0f,1.0f);glColor3f(1.0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,0.0f);glColor3f(1.0f,0.0f,1.0f);glVertex3f(1.0f,-1.0f,1.0f);glColor3f(0.0f,1.0f,0.0f);glVertex3f(1.0f,-1.0f,-1.0f);glColor3f(1.0f,0.0f,0.0f);glVert
这篇关于计算机图形学 -- 变换之旋转二 [鼠标操作]的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!