opengl 立方体

opengl 立方体

ID:24965667

大小:183.50 KB

页数:31页

时间:2018-11-17

opengl 立方体_第1页
opengl 立方体_第2页
opengl 立方体_第3页
opengl 立方体_第4页
opengl 立方体_第5页
资源描述:

《opengl 立方体》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、三角形#include#includevoidmyinit(void){glClearColor(1.0,1.0,1.0,1.0);}voidDrawTriangle(void){glBegin(GL_TRIANGLES);glVertex2f(20.0,20.0);glVertex2f(80.0,30.0);glVertex2f(50.0,70.0);glEnd();}voiddisplay(void){glClear(GL_COLOR_BUFFER_BIT);glColor

2、3f(0.0,0.0,0.0);glPolygonMode(GL_FRONT,GL_LINE);DrawTriangle();glPushMatrix();glEnable(GL_LINE_STIPPLE);glLineStipple(1,0xF0F0);glTranslatef(90.0,0.0,0.0);DrawTriangle();glPopMatrix();glPushMatrix();glLineStipple(1,0x8888);glTranslatef(20.0,80.0,0.0);glScalef(0.5

3、,1.5,1.0);DrawTriangle();glPopMatrix();glPushMatrix();glLineStipple(1,0xF00F);glTranslatef(110.0,90.0,0.0);glRotatef(30.0,0.0,0.0,1.0);DrawTriangle();glPopMatrix();glFlush();}voidmyreshape(intw,inth){glViewport(0,0,(GLsizei)w,(GLsizei)h);glMatrixMode(GL_PROJECTIO

4、N);glLoadIdentity();gluOrtho2D(0.0,(GLdouble)w,0.0,(GLdouble)h);}intmain(intargc,char*argv[]){glutInit(&argc,argv);glutInitWindowSize(200,200);glutInitWindowPosition(200,200);glutCreateWindow("Transform");myinit();glutDisplayFunc(display);glutReshapeFunc(myreshap

5、e);glutMainLoop();return0;}voiddisplay(void){glClear(GL_COLOR_BUFFER_BIT);glColor3f(0.0,0.0,0.0);glPolygonMode(GL_FRONT,GL_LINE);DrawTriangle();/*glPushMatrix();glEnable(GL_LINE_STIPPLE);glLineStipple(1,0xF0F0);glTranslatef(90.0,0.0,0.0);DrawTriangle();glPopMatri

6、x();glPushMatrix();glLineStipple(1,0x8888);glTranslatef(20.0,80.0,0.0);glScalef(0.5,1.5,1.0);DrawTriangle();glPopMatrix();glPushMatrix();glLineStipple(1,0xF00F);glTranslatef(110.0,90.0,0.0);glRotatef(30.0,0.0,0.0,1.0);DrawTriangle();glPopMatrix();*/glFlush();}voi

7、ddisplay(void){glClear(GL_COLOR_BUFFER_BIT);glColor3f(0.0,0.0,0.0);/*glPolygonMode(GL_FRONT,GL_LINE);DrawTriangle();*/glPushMatrix();glEnable(GL_LINE_STIPPLE);glLineStipple(1,0xF0F0);glTranslatef(90.0,0.0,0.0);DrawTriangle();glPopMatrix();/*glPushMatrix();glLineS

8、tipple(1,0x8888);glTranslatef(20.0,80.0,0.0);glScalef(0.5,1.5,1.0);DrawTriangle();glPopMatrix();glPushMatrix();glLineStipple(1,0xF00F);glTranslatef(110.0,90.0,

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。