【OpenGL】指定着色模型代码
来源:互联网 发布:淘宝仓管的职责 编辑:程序博客网 时间:2024/06/06 06:44
#include <GL/glut.h>#include <math.h>//指定着色模型的代码const GLfloat PI = 3.1415926536;void myDisplay(void){ int i; glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLE_FAN);//三角扇形 glColor3f(1.0f, 1.0f, 1.0f); glVertex2f(0.0f, 0.0f); for (i = 0; i <= 8; i++) { glColor3f(i & 0x04, i & 0x02, i & 0x01); //当i为0 时,与0x04的二进制0100进行&,得到结果依然为0; //当i为1 时,与0x04的二进制0100进行&,得到结果依然为0; //以此类推。。。 glVertex2f(cos(i*PI / 4), sin(i*PI / 4)); } glEnd(); glFlush();}int main(int argc, char **argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); glutInitWindowPosition(100, 100); glutInitWindowSize(400, 400); glutCreateWindow("demo"); glutDisplayFunc(&myDisplay); glutMainLoop(); return 0;}
阅读全文
0 0
- 【OpenGL】指定着色模型代码
- opengl 指定着色模型
- opengl学习笔记之指定着色模型
- openGL指定着色模式
- 《高效学习OpenGL》 之 指定颜色和着色模型 glClampColor(),glIndexf(),glClearIndex(),glShadeModel()
- OpenGL 着色
- OpenGL着色
- 探究OpenGL光照模型的着色器实现
- OpenGL着色器与Phong光照明模型
- 代码着色
- 代码着色
- OpenGl定点着色
- openGL混合渐变着色
- OpenGL ES着色语言
- OpenGL 着色器语言
- OpenGL ADSGouraud着色
- OpenGL ADSPhong着色
- opengl着色步骤
- 与C语言不同,JAVA里没有无符号整型
- 404的问题
- Spring第二天
- linux进程调度1_设计思想
- Zookeeper acl超级用户
- 【OpenGL】指定着色模型代码
- 24天学会设计模式----门面模式(外观模式)
- coto使用方式及原理
- Git创建本地仓库并同步到远程
- Codeforecs 359D Pair of Numbers 单调栈 OR ST表+二分
- vue.js自定义组件directives
- 微信小程序中也可以使用三元运算符且可嵌套使用
- 素数距离问题
- gis-----Express 有屁关系