2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 计算机图形图像ppt 计算机图形图像绘制技术.ppt

计算机图形图像ppt 计算机图形图像绘制技术.ppt

时间:2018-06-29 12:33:12

相关推荐

计算机图形图像ppt 计算机图形图像绘制技术.ppt

《计算机图形图像绘制技术.ppt》由会员分享,可在线阅读,更多相关《计算机图形图像绘制技术.ppt(49页珍藏版)》请在人人文库网上搜索。

1、计算机图形图像绘制技术,第二讲,主要内容,显示三维坐标的程序(1) 几何对象的变换 变换矩阵 平移glTranslatef 旋转glRotatef 缩放glScalef 三维实体 显示三维坐标的程序(2) 颜色 点与线的属性 面的显示 隐藏面与深度缓冲 多边形面的方向 显示模式 练习,显示三维坐标的程序(1),变换矩阵,在OpenGL中使用矩阵进行渲染三维场景所需要的数据计算 为简化操作,OpenGL提供一个矩阵栈,每次用栈顶的矩阵对给定的物体或场景进行渲染 用glPushMatrix和glPopMatrix函数来将矩阵压栈和出栈,还可以用glScalef和glRotatef等函数对栈顶的矩阵。

2、进行缩放和旋转等修改,Push / Pop Matrix,void glPushMatrix(void);,Push / Pop Matrix,void glPopMatrix(void);,Example,glPushMatrix(); glTranslatef(.); glRotatef(.); glScalef(.); glutSolidCylinder(.); glPopMatrix();,平移glTranslatef,void glTranslated (GLdouble x, GLdouble y, GLdouble z); void glTranslatef (GLfloat x。

3、, GLfloat y, GLfloat z); 演示,旋转glRotatef,void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); 演示,缩放glScalef,void glScaled (GLdouble x, GLdouble y, GLdouble z); void glScalef (GLfloat x, GLfloat y, GLfloat z); 演示,Example,。

4、glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); 。

5、glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Example,glLoadIdentity(); glPushMatrix。

6、(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatri。

7、x(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Identity,Example,glLoadIdenti。

8、ty(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTra。

9、nslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Tr。

10、anslate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Rotate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadI。

11、dentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatri。

12、x();,Identity,平移与旋转的次序很重要,glLoadIdentity() glRotated(45, 0, 0, 1) glTranslated(5, 0, 0),OpenGL commands successively define new “local” coordinate spaces in terms of the “current” or previous local space.,三维实体对象,Glaux.lib库 void auxWireSphere(GLdouble); void auxSolidSphere(GLdouble); void auxWireCube。

13、(GLdouble); void auxSolidCube(GLdouble); void auxWireBox(GLdouble, GLdouble, GLdouble); void auxSolidBox(GLdouble, GLdouble, GLdouble); void auxWireTorus(GLdouble, GLdouble); void auxSolidTorus(GLdouble, GLdouble); void auxWireCylinder(GLdouble, GLdouble); void auxSolidCylinder(GLdouble, GLdouble); 。

14、void auxWireIcosahedron(GLdouble); void auxSolidIcosahedron(GLdouble); void auxWireOctahedron(GLdouble); void auxSolidOctahedron(GLdouble); void auxWireTetrahedron(GLdouble); void auxSolidTetrahedron(GLdouble); void auxWireDodecahedron(GLdouble); void auxSolidDodecahedron(GLdouble); void auxWireCone。

15、(GLdouble, GLdouble); void auxSolidCone(GLdouble, GLdouble); void auxWireTeapot(GLdouble); void auxSolidTeapot(GLdouble);,球,立方体,长方体,圆环,圆柱,二十面体,八面体,四面体,十二面体,圆锥,茶壶,Glut库 void glutWireSphere(GLdouble radius, GLint slices, GLint stacks); void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);。

16、 void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutWireCube(GLdouble size); void glutSolidCube(GLdouble size); void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint si。

17、des, GLint rings); void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); void glutWireDodecahedron(void); void glutSolidDodecahedron(void); void glutWireTeapot(GLdouble size); void glutSolidTeapot(GLdouble size); void glutWireOctahedron(void); void glutSolidOctah。

18、edron(void); void glutWireTetrahedron(void); void glutSolidTetrahedron(void); void glutWireIcosahedron(void); void glutSolidIcosahedron(void);,显示三维坐标的程序(2),(演示),颜色,glColor3fv(face color) render_face() glColor3fv(eye color) render_eyes() glColor3fv(hair color) render_hair() glColor3fv(teeth color) re。

19、nder_teeth(),Colors,颜色其有四个分量: R- 红 Red. G- 绿 Green. B- 蓝 Blue. A- 透明度 Transparent.,glShadeModel(GL_FLAT); glBegin(GL_QUADS); glColor3f (1.0,0.0,0.0); glVertex3f(0.0,0.0,0.0); glColor3f (0.0,1.0,0.0); glVertex3f(1.0,0.0,0.0); glColor3f (0.0,0.0,1.0); glVertex3f(1.0,1.0,0.0); glColor3f (1.0,1.0,0.0); 。

20、glVertex3f(0.0,1.0,0.0); glEnd();,Shading Models,glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); glColor3f (1.0,0.0,0.0); glVertex3f(0.0,0.0,0.0); glColor3f (0.0,1.0,0.0); glVertex3f(1.0,0.0,0.0); glColor3f (0.0,0.0,1.0); glVertex3f(1.0,1.0,0.0); glColor3f (1.0,1.0,0.0); glVertex3f(0.0,1.0,0.0); glEnd()。

21、;,Shading Models,演示,点与线的属性,演示,深度缓冲区,当我们从某处看景物时,接近于视点的物体遮挡了离视点较远的物体。 深度缓冲区为每个像素保存一个距离或深度值,以便让OpenGL通过简单方法做隐藏面计算。 只有当新像素的深度值小于旧像素的深度值时,才允许像素的覆盖。,画家算法与深度排序,画家算法的局限性,解决办法:分割成两个,演示,多边形面的方向,法线方向的指定方法一,根据顶点顺序确定,法线方向的指定方法二,指定法线,面的可见性,void glCullFace (GLenum mode); GLenum取值:GL_FRONT、GL_BACK、GL_FRONT_AND_BACK,多边形显示模式,glPolygonMode(GLenum face, GLenum mode);,GL_FILL, GL_LINE, GL_POINT,GL_FRONT, GL_BACK, GL_FRONT_AND_BACK,GL_FILL,GL_LINE,GL_POINT,演示,练习,1. 简单的城市模型,2 三维飞机模型,3,4 作三维成绩统计饼图或条形图,第二次课和第三次课练习作为一次大作业; 可任选题目; 第一次大作业在第四次课,上课之前交. 作业发email至。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。