QT5-三维
来源:互联网 发布:jenkins 源码 编辑:程序博客网 时间:2024/04/27 22:40
//三维glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();glTranslatef(-1.5, 0.0, -6.0);glRotatef(rTri, 0.0, 1.0, 0.0);glBegin(GL_TRIANGLES);//前侧面glColor3f(1.0, 0.0, 0.0);glVertex3f(0.0, 1.0, 0.0);glColor3f(0.0, 1.0, 0.0);glVertex3f(-1.0, -1.0, 1.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(1.0, -1.0, 1.0);//右侧面glColor3f(1.0, 0.0, 0.0);glVertex3f(0.0, 1.0, 0.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(1.0, -1.0, 1.0);glColor3f(0.0, 1.0, 0.0);glVertex3f(1.0, -1.0, -1.0);//后侧面glColor3f(1.0, 0.0, 0.0);glVertex3f(0.0, 1.0, 0.0);glColor3f(0.0, 1.0, 0.0);glVertex3f(1.0, -1.0, -1.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(-1.0, -1.0, -1.0);//左侧面glColor3f(1.0, 0.0, 0.0);glVertex3f(0.0, 1.0, 0.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(-1.0, -1.0, -1.0);glColor3f(0.0, 1.0, 0.0);glVertex3f(-1.0, -1.0, 1.0);glEnd();rTri += 1.2;//底面glBegin(GL_QUADS);glColor3f(0.0, 1.0, 0.0);glVertex3f(1.0, -1.0, 1.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(1.0, -1.0, -1.0);glColor3f(0.0, 0.0, 1.0);glVertex3f(-1.0, -1.0, -1.0);glColor3f(0.0, 1.0, 0.0);glVertex3f(-1.0, -1.0, 1.0);glEnd();//立方体glLoadIdentity();glTranslatef(1.5, 0.0, -7.0);glRotatef(rQuad,1.0,1.0,1.0);#define f1 1.0, 1.0, 1.0#define f2 -1.0, 1.0, 1.0#define f3 -1.0, -1.0, 1.0#define f4 1.0, -1.0, 1.0#define b1 -1.0, 1.0, -1.0#define b2 1.0, 1.0, -1.0#define b3 1.0, -1.0, -1.0#define b4 -1.0, -1.0, -1.0glBegin(GL_QUADS);//正侧面glColor3f(1.0, 0.0, 0.0);glVertex3f(f1);glVertex3f(f2);glVertex3f(f3);glVertex3f(f4);void setpoint(int o1, int p1, int q1,int o2, int p2, int q2,int o3, int p3, int q3,int o4, int p4, int q4);//右侧面glColor3f(1.0,0.5, 0.0);setpoint(b2, f1, f4, b3);//其实就是按顺序glVertex3f()四个点//后侧面glColor3f(0.0, 1.0, 1.0);setpoint(b1, b2, b3, b4);//左侧面glColor3f(0.0, 0.5, 1.0);setpoint(f2, b1, b4, f3);//上底面面glColor3f(0.0, 0.0, 1.0);setpoint(b2, b1, f2, f1);//下底面glColor3f(0.0, 1.0, 0.0);setpoint(b4, b3, f4, f3);glEnd();rQuad -= 1.0;
还是修改paintGL()三维就是把立方体的几个面都画出来,画面的时候注意逆时针开始画(画的顺序要一致),面的连接点要注意一致
0 0
- QT5-三维
- QT5 r 加入qwtplot3d 三维库
- PCL1.8.1+Qt5.9.1+VS2015联合编译和显示三维图像
- qt5
- qt5
- QT5
- 三维GIS
- 三维管线
- 三维饼状图
- 三维坐标系
- 三维直方图
- 三维GIS
- 三维数组
- 三维数组
- 三维观察
- 三维GIS
- 三维变换
- 三维图形学
- Android scrollTo() scrollBy() Scroller讲解及应用
- zoj 3810 A Volcanic Island
- Ralph Lauren Outlet And also law enforcement agency suggest it had been a new unchosen taking pictur
- Cheap Polo Ralph Lauren Everything that is important is definitely that you really interact with the
- Android SwitchButton(滑动开关)
- QT5-三维
- 【送福利啦~】海大各外卖电话
- 不要离你的目标太远
- Android 自定义UI--电池
- myeclipse8.5上安装 Maven3.0.5插件
- 基于Node.js + jade + Mongoose 模仿gokk.tv
- 关于大数的进制转换问题
- 鸟哥的 Linux 私房菜笔记 TCP/IP 的网络层相关封包与数据
- 黑马程序员_java线程进阶