图形学考题整理
《图形学考题整理》由会员分享,可在线阅读,更多相关《图形学考题整理(22页珍藏版)》请在装配图网上搜索。
1、OpenGL32.lib GLu32.lib 和 GLaux.lib图形学上机测试题目整理1. 立方体正方体放缩在前面定义:int Angle = 0;int DrawGLSceneglClear;glLoadIdentity;float a=10.0;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glScalef;glPushMatrix;glBegin;/glColor3f ;/将绘图色设置为红色leftgl
2、Vertex3f;glVertex3f;glVertex3f;glVertex3f;glColor3f ;/将绘图色设置为黄色前面glVertex3f;glVertex3f; glVertex3f;glVertex3f;glColor3f ;/将绘图色设置为绿色backglVertex3f;glVertex3f;glVertex3f;glVertex3f;glColor3f ;/将绘图色设置为兰色upglVertex3f;glVertex3f;glVertex3f;glVertex3f;glColor3f ;/将绘图色设置为青色downglVertex3f;glVertex3f;glVerte
3、x3f;glVertex3f;glColor3f ;/将绘图色设置为紫色右glVertex3f;glVertex3f;glVertex3f;glVertex3f;glEnd;glPopMatrix;if5Angle=-0;Sleep;Angle +=1;/旋转角度增量Sleep;return TRUE;2. 圆锥放缩在前面定义:int Angle = 0;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;g
4、lTranslatef;glScalef;glRotatef;glRotatef;glPushMatrix;/圆柱台glBegin;forfloat j=0;j float k; /k=2/;glColor3f;glVertex3f30*cosf,0, 30*sinf ; glColor3f; glVertex3fAngle*cosf,Angle, Angle*sinf ;/将50改30变圆台 glEnd;glPopMatrix;if50Angle=0;/旋转角度增量elseAngle +=10;Sleep;return TRUE;3. 圆台大到小在前面定义:int Angle = 50;in
5、t DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef; glRotatef;glPushMatrix;/圆柱台glBegin;forfloat j=0;j float k; /k=2/; glColor3f; glVertex3f50*cosf,-50, 50*sinf ;/将50改30变圆台 glColor3f; glVertex3fAngle*cosf,Angle, A
6、ngle*sinf ;glEnd;glPopMatrix;if0Angle-=10;/旋转角度增量elseAngle=50 ;Sleep;return TRUE;4.圆台前后旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glPushMatrix;/圆柱台glBegin;for
7、float j=0;j float k; /k=2/;glColor3f;glVertex3f30*cosf,50, 30*sinf ; glColor3f; glVertex3f50*cosf,-50, 50*sinf ;/将50改30变圆台 glEnd;glPopMatrix;Angle +=15;if360Angle=0;/旋转角度增量Sleep;return TRUE;5圆柱左右旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;glEnable;/启用深度检测glMatrixMod
8、e;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glRotatef;glPushMatrix;/圆柱台glBegin;forfloat j=0;j float k; /k=2/;glColor3f;glVertex3f50*cosf,50, 50*sinf ; glColor3f; glVertex3f50*cosf,-50, 50*sinf ;/将50改30变圆台 glEnd;glPopMatrix;Angle -=15;ifAngleAngle=0;/旋转角度增量Sleep;return TRUE;6
9、.球前后旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glPushMatrix;/球前后旋转glScalef;float rx,ange1=0;forfloat i=0;i/上下20份float k,j;k=i/20;glBegin;for j=0;j/旋转360度rx=co
10、sf3.1416f/2.0f-3.1416f/20*;glColor3f;glVertex3frx*cosf,/设置顶点1sinf,-rx*sinf;rx=cosf3.1416f/2.0f-3.1416f/20*;glColor3f;glVertex3frx*cosf,/设置顶点2sinf3.1416f/2.0f-3.1416f/20*,-rx*sinf;ange1=3.1416f/180.0f*j;/旋转360度;glEnd;glPopMatrix;Angle +=25;if360Angle=0;/旋转角度增量Sleep;return TRUE;7.球左右旋转.将上一题中的glRotatef
11、;改为glRotatef;将glScalef;改为:glScalef;将Angle +=25;if360Angle=0;/旋转角度增量改为:Angle -=30;ifAngleAngle=0;/旋转角度增量8.半球旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glPushMa
12、trix;/半球左右旋转glScalef;float rx,ange1=0;forfloat i=0;i/上下20份float k,j;k=i/10;glBegin;for j=0;j/旋转360度rx=cosf3.1416f/2.0f-3.1416f/20*;glColor3f;glVertex3frx*cosf,/设置顶点1sinf,-rx*sinf; rx=cosf3.1416f/2.0f-3.1416f/20*;glColor3f;glVertex3frx*cosf,/设置顶点2sinf3.1416f/2.0f-3.1416f/20*,-rx*sinf;ange1=3.1416f/18
13、0.0f*j;/旋转360度;glEnd;glPopMatrix;Angle +=15;if360Angle=0;/旋转角度增量Sleep;return TRUE;9. 两个圆锥点对点左右旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glRotatef;glPushMatri
14、x;/圆锥glBegin;forfloat j=0;j float k; /k=2/;glColor3f;glVertex3f0*cosf,0, 0*sinf ; glColor3f; glVertex3f50*cosf,80, 50*sinf ;/将50改30变圆台 glColor3f; glEnd;glBegin;forfloat i=0;i float k; /k=2/;glColor3f;glVertex3f0*cosf,0, 0*sinf ; glColor3f; glVertex3f50*cosf,-80, 50*sinf ;/将50改30变圆台 glEnd;glPopMatrix
15、;Angle +=10;if360Angle=0;/旋转角度增量Sleep;return TRUE;10. 两圆锥倒扣旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glRotatef;glPushMatrix;/圆锥glBegin;forfloat j=0;j float k
16、; /k=2/;glColor3f;glVertex3f0*cosf,-70, 0*sinf ; glColor3f; glVertex3f50*cosf,0, 50*sinf ;/将50改30变圆台 glColor3f; glEnd;glBegin;forfloat i=0;i float k; /k=2/;glColor3f;glVertex3f0*cosf,70, 0*sinf ;glColor3f; glVertex3f50*cosf,0, 50*sinf ;/将50改30变圆台 glEnd;glPopMatrix;Angle +=10;if360Angle=0;/旋转角度增量Slee
17、p;return TRUE;11. .圆柱加圆锥旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glRotatef;glPushMatrix;/圆锥glBegin;forfloat j=0;j float k; /k=2/;glColor3f;glVertex3f50*cosf
18、,0, 50*sinf ;glColor3f; glVertex3f0*cosf,-50, 0*sinf ;/将50改30变圆台 glColor3f; glEnd;/圆柱glBegin;forfloat i=0;i float k; /k=2/;glColor3f;glVertex3f50*cosf,0, 50*sinf ;glColor3f; glVertex3f50*cosf,60, 50*sinf ;/将50改30变圆台 glEnd;glPopMatrix;Angle +=10;if360Angle=0;/旋转角度增量Sleep;return TRUE;12.正六边形前后旋转在前面定义:
19、int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef; glScalef;glPushMatrix;glBegin;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3
20、f;glVertex3f;glColor3f;glVertex3f; glColor3f;glVertex3f;glEnd;glPopMatrix;Angle +=10;if360Angle=0;/旋转角度增量Sleep;return TRUE;13.正六边形左右旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRo
21、tatef;glRotatef;glScalef;glPushMatrix;glBegin;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f; glColor3f;glVertex3f;glEnd;glPopMatrix;Angle +=10;if360Angle=0;/旋转角度增量Sleep;return TRUE;14.正六边形沿点旋转在前面定义:int Angle = 50;int Dra
22、wGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glRotatef;glScalef;glPushMatrix;glBegin;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;glVertex3f;glColor3f;
23、glVertex3f; glColor3f;glVertex3f;glEnd;glPopMatrix;Angle +=10;if360Angle=0;/旋转角度增量Sleep;return TRUE;15.正六边形对半上下旋转在前面定义:int Angle = 50;int DrawGLSceneglClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glScalef;glPushMatrix;glB
24、egin;glColor3f; glVertex3f; glVertex3f; glVertex3f; glVertex3f; glEnd; glPopMatrix; glRotatef; glPushMatrix; glBegin; glColor3f;glVertex3f; glVertex3f; glVertex3f; glVertex3f;glEnd;glPopMatrix;Angle -=10;ifAngleAngle=0;/旋转角度增量Sleep;return TRUE;16.正六边形对半左右旋转在前面定义:int Angle = 50;int DrawGLSceneglTrans
25、latef;glScalef;glClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glScalef;glPushMatrix; glBegin;glColor3f; glVertex3f; glVertex3f; glVertex3f; glVertex3f; glEnd; glPopMatrix; glRotatef; glPushMatrix; glBegin; glColor3f;glVe
26、rtex3f; glVertex3f; glVertex3f; glVertex3f; glEnd;glPopMatrix;Angle -=10;ifAngleAngle=0;/旋转角度增量Sleep;return TRUE;18.正六边形正弦线由左到右在前面定义:int Angle = 0int DrawGLSceneglTranslatef;glScalef;glClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef
27、;glScalef;glRotatef;glTranslatefAngle,30.0f*sinf,0.0f;glPushMatrix;glBegin;float ang=60*3.142/180; glColor3f ;/将绘图色设置为红色leftglVertex3f10*cosf,10*sin,0.0f;glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,
28、10*sinf,0.0f;glEnd;glPopMatrix;if100Angle=-100;Angle +=5;Sleep;return TRUE;19.正六边形余弦线由左到右在前面定义:int Angle = 0int DrawGLSceneglTranslatef;glScalef;glClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glTranslatefAngle,
29、30.0f*cosf,0.0f;glPushMatrix;glBegin;float ang=60*3.142/180; glColor3f ;/将绘图色设置为红色leftglVertex3f10*cosf,10*sin,0.0f;glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glEnd;glPopMatrix;if100A
30、ngle=-100;Angle +=5;Sleep;return TRUE;20.正六边形顺时针绕圆运动在前面定义:int Angle = 0int DrawGLSceneglTranslatef;glScalef;glClear;glLoadIdentity;int a=10;glClear;/清除颜色和深度缓冲区glEnable;/启用深度检测glMatrixMode;glColor3f;glLoadIdentity;glTranslatef;glScalef;glRotatef;glTranslatef50*sinf,50*cosf,0.0f;glPushMatrix;glBegin;float ang=60*3.142/180; glColor3f ;/将绘图色设置为红色leftglVertex3f10*cosf,10*sin,0.0f;glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f; glVertex3f10*cosf,10*sinf,0.0f;
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。