计算机图形图像绘制技术

上传人:jian****019 文档编号:253303896 上传时间:2024-12-11 格式:PPT 页数:49 大小:486KB
收藏 版权申诉 举报 下载
计算机图形图像绘制技术_第1页
第1页 / 共49页
计算机图形图像绘制技术_第2页
第2页 / 共49页
计算机图形图像绘制技术_第3页
第3页 / 共49页
资源描述:

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

1、单击此处编辑母版标题样式,,单击此处编辑母版文本样式,,第二级,,第三级,,第四级,,第五级,,,*,计算机图形图像绘制技术,,第二讲,,,主要内容,,显示三维坐标的程序(1),,几何对象的变换,,变换矩阵,,平移glTranslatef,,旋转glRotatef,,缩放glScalef,,三维实体,,显示三维坐标的程序(2),,颜色,,点与线的属性,,面的显示,,隐藏面与深度缓冲,,多边形面的方向,,显示模式,,练习,,,,显示三维坐标的程序(1),,,,变换矩阵,,在OpenGL中使用矩阵进行渲染三维场景所需要的数据计算,,为简化操作,OpenGL提供一个矩阵栈,每次用栈顶的矩阵对给定的物

2、体或场景进行渲染,,用glPushMatrix和glPopMatrix函数来将矩阵压栈和出栈,还可以用glScalef和glRotatef等函数对栈顶的矩阵进行缩放和旋转等修改,,Push / Pop Matrix,,void,glPushMatrix,(void);,,,Push Matrix,,Push / Pop Matrix,,Pop Matrix,void,glPopMatrix,(void);,,,,Example,,glPushMatrix();,,glTranslatef(...);,,glRotatef(...);,,glScalef(...);,,glutSolidCyli

3、nder(...);,,glPopMatrix();,,,平移glTranslatef,,void glTranslated (GLdouble x, GLdouble y, GLdouble z);,,void glTranslatef (GLfloat x, GLfloat y, GLfloat z);,,,演示,,,旋转glRotatef,,void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);,,void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GL

4、float z);,,,演示,,缩放glScalef,,void glScaled (GLdouble x, GLdouble y, GLdouble z);,,void glScalef (GLfloat x, GLfloat y, GLfloat z);,,,演示,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…)

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

6、tef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,,Example,,glLoadIdentity();,,glPushMatrix();,,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMat

7、rix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,,

8、Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,Identity,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPu

9、shMatrix();,,glLoadIdentity();,,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,Identity,,Translate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,,glPopM

10、atrix();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Ide

11、ntity,,Translate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,Rotate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTran

12、slatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix();,,glPushMatrix();,,glRotatef (…);,,,glPopMatrix();,,glPopMatrix();,,Identity,,Translate,,,Example,,glLoadIdentity();,,glPushMatrix();,,glTranslatef (…);,,glPushMatrix();,,glLoadIdentity();,,glTranslate (…);,,glPopMatrix

13、();,,glPushMatrix();,,glRotatef (…);,,glPopMatrix();,,glPopMatrix();,,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库,,

14、void auxWireSphere(GLdouble);,,void auxSolidSphere(GLdouble);,,void auxWireCube(GLdouble);,,void auxSolidCube(GLdouble);,,void auxWireBox(GLdouble, GLdouble, GLdouble);,,void auxSolidBox(GLdouble, GLdouble, GLdouble);,,void auxWireTorus(GLdouble, GLdouble);,,void auxSolidTorus(GLdouble, GLdouble);,,

15、void auxWireCylinder(GLdouble, GLdouble);,,void auxSolidCylinder(GLdouble, GLdouble);,,void auxWireIcosahedron(GLdouble);,,void auxSolidIcosahedron(GLdouble);,,void auxWireOctahedron(GLdouble);,,void auxSolidOctahedron(GLdouble);,,void auxWireTetrahedron(GLdouble);,,void auxSolidTetrahedron(GLdouble

16、);,,void auxWireDodecahedron(GLdouble);,,void auxSolidDodecahedron(GLdouble);,,void auxWireCone(GLdouble, GLdouble);,,void auxSolidCone(GLdouble, GLdouble);,,void auxWireTeapot(GLdouble);,,void auxSolidTeapot(GLdouble);,球,,立方体,,长方体,,圆环,,圆柱,,二十面体,,八面体,,四面体,,十二面体,,圆锥,,茶壶,,,Glut库,,void glutWireSphere(G

17、Ldouble radius, GLint slices, GLint stacks);,,void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);,,void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);,,void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);,,void glutWireCube(GLdoubl

18、e size);,,void glutSolidCube(GLdouble size);,,void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);,,void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);,,void glutWireDodecahedron(void);,,void glutSolidDodecahedron(void);,,vo

19、id glutWireTeapot(GLdouble size);,,void glutSolidTeapot(GLdouble size);,,void glutWireOctahedron(void);,,void glutSolidOctahedron(void);,,void glutWireTetrahedron(void);,,void glutSolidTetrahedron(void);,,void glutWireIcosahedron(void);,,void glutSolidIcosahedron(void);,,显示三维坐标的程序(2),,(演示),,颜色,,glCo

20、lor3fv(face color),,render_face(),,glColor3fv(eye color),,render_eyes(),,glColor3fv(hair color),,render_hair(),,glColor3fv(teeth color),,render_teeth(),,Colors,颜色其有四个分量:,,,,R - 红 Red.,,G - 绿 Green.,,B - 蓝 Blue.,,A - 透明度 Transparent.,关于透明处理…,在后面讲,!,,glShadeModel(GL_FLAT);,,glBegin(GL_QUADS);,,glCo

21、lor3f (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();,Shading Models,,,glShadeModel(GL_SMOOTH);,,glBegin(GL_QUADS);,,glColor3f (1.0,0.0,

22、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();,Shading Models,,,演示,,,,点与线的属性,,,void,glPointSize(GLfloat,size);,,void,glLineWidth(GLfloat,width);,,

23、glLineStipple(1, 0x3F07);,glEnable(GL_LINE_STIPPLE);,,void,glLineStipple(GLint,factor,,Glushort,pattern);,,演示,,,,深度缓冲区,,当我们从某处看景物时,接近于视点的物体遮挡了离视点较远的物体。,,深度缓冲区为每个像素保存一个距离或深度值,以便让OpenGL通过简单方法做隐藏面计算。,,只有当新像素的深度值小于旧像素的深度值时,才允许像素的覆盖。,,,,,画家算法与深度排序,,,,画家算法的局限性,,解决办法:分割成两个,,演示,,,,多边形面的方向,,,,,back-face,norm

24、al pointing inside,,法线方向的指定方法一,,v,0,v,1,v,2,v,3,v,0,v,1,v,2,v,3,根据顶点顺序确定,,法线方向的指定方法二,,指定法线,,面的可见性,,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至:liuzhongtu@,,

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

相关资源

更多
正为您匹配相似的精品文档
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  sobing.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!