




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Computer
GraphicsChen
xue
gongTeaching
Material
and
References
1.Donald
Hearn,M.Pauline
Baker,Computer
Graphics
with
OpenGL,ThirdEdition,电子工业出版社,2004.
2.Dave
Shreiner,Mason
Woo,OpenGL编程指南(OpenGL
Programming
Guide,Fifth
Edition),机械工业出版社,2006.Section1.Building
OpenGLApplication
1.Copy
GLUT.dll
and
GLUT32.dll
to
folderSysten322.Copy
GLUT32.lib
to
vc
lib
folder3.Copy
glut.h
to
vc
include
folder4.New
a
console
project5.Edit
or
import
OpenGL
codepile
and
run
applicationSection1.Building
OpenGLApplication7.Example(1)colormat.c(2)material.c(3)pointp.c(4)line.cSection2.
Graphics
Output(1)1.Coordinate
system(1)Screen
coordinates(2)World
coordinates(Cartesian
coordinat2.OpenGL
projections3.OpenGL
point
functions4.OpenGL
line
functions5.Line-drawing
algorithmsSection2.
Graphics
Output(1)DDA(digital
differential
analyzer)
algorithmSection2.
Graphics
Output(1)Bresenham’s
line
algorithmSection2.
Graphics
Output(1)Bresenham’s
line
algorithm–
d1=
dx(2y1-2y0-1)=2dy-dx;–if(di>=0){– yi=yi-1+1;– di+1=di+2(dy-dx);–
}else
{yi=yi-1
;di+1=di+2dy;–
}Section3.
Graphics
Output(2)1.
PolygonConvex(凸)
polygon: all
interior
angles
of
apolygon
are
less
than
or
equal
to
180°.Concave(凹)polygon:
a
polygon
is
not
convex.Degenerate(退化)polygon:
a
set
of
verticesthat
are
collinear
or
at
the
same
position.In
OpenGL,
a
fill
area
must
be
specified
asa
convex
polygon.Section3.
Graphics
Output(2)2.OpenGL
polygon
fill-area
functions–
glRect*(x1,
y1,
x2,
y2);glBegin(GL_POLYGON);glBegin(GL_TRIANGLES);glBegin(GL_TRIANGLE_STRIP);glBegin(GL_TRIANGLE_FAN);glBegin(GL_QUADS);glBegin(GL_QUAD_STRIP);examples:
polys.cSection3.
Graphics
Output(2)3.OpenGL
bitmap
and
image
functionsglBitmap(width,
height,
x0,
y0,
dx,
dy,
bitmaglRasterPos*();glDrawPixel(width,
height,
dataFormat,dataType,
pixmap);Section3.
Graphics
Output(2)4.OpenGL
display
lists(显示列表)glGenLists(number);glNewList(listID,
listMode);glCalnlList(listID);example
:
font.c,
image.cSection4.
GeometricTransformations(1)1.Projectionsvoid
glOrtho(GLdouble
left,
GLdouble
right,GLdouble
bottom,
GLdouble
top,
GLdoublezNear,
GLdouble
zFar);void
glOrtho2D(GLdouble
left,
GLdouble
rightGLdouble
bottom,
GLdouble
top);Section4.
GeometricTransformations(1)nearfarview
directiontopbottomleftrightSection4.
GeometricTransformations(1)Section4.
GeometricTransformations(1)void
glFrustum(GLdouble
left,
GLdouble
rightGLdouble
bottom,
GLdouble
top,
GLdoublezNear,
GLdouble
zFar);void
glFrustum(GLdouble
left,
GLdouble
rightGLdouble
bottom,
GLdouble
top,
GLdoublezNear,
GLdouble
zFar);Section4.
GeometricTransformations(1)farleft
rightnearbottomtopview
pointSection4.
GeometricTransformations(1)Section4.
GeometricTransformations(1)2.Model-view
transformationsvoid
glRotate{f,d}(TYPE
angle,
TYPE
x,TYPE y,
TYPE
z);void
glTranslate{f,d}(TYPE x,
TYPE y,
TYPEz);void
glScale{f,d}(TYPE x,
TYPE y,
TYPE
z);3.Example
:
geometryTransform.cSection5.
GeometricTransformations(2)1.TranslationSection5.
GeometricTransformations(2)2.ScaleSection5.
GeometricTransformations(2)3.RotationSection6.Texture1、Texture
Functionsvoid
glGenTextures(GLsizei
n,GLuint
*textures);void
glTexImage2D(GLenum
target,GLint
level,GLintinternalFormat,GLsizei
width,
GLsizeiheight,GLintborder,
GLenum
format,
GLenum
type,const
GLvoid*pixels);void
glTexImage1D(GLenum
target,GLint
level,GLintinternalFormat,GLsizei
width,
GLsizeiheight,GLintborder,
GLenum
format,
GLenum
type,const
GLvoid*pixels);Section6.Texture2.Texture
Parametersvoid
glTexParameter{i,f}(GLenum
target,
GLenumpName,TYPE
param);void
glTexParameter{i,f}v(GLenum
target,
GLenumpName,TYPE
*param);functions:set
texture
parameters.
input:target
is
texture
type(GL_TEXTURE_1D,GL_TEXTURE_2D),pName
is
texture
name(GL_TEXTURE_BORDER_COLOR、
GL_TEXTURE_WRAP_S、GL_TEXTURE_WRAP_T、
GL_TEXTURE_MIN_FILTER、GL_TEXTURE_MAG_FILTER),paramif
valueof
pName.output:nothing.return:nothing.Section6.Texture3、Texture
Coordinatevoid
glTexCoord{1,2,3,4}{d,f,i,s}(TYPE
s,TYPE
t,
TYPE
r,
TYPE
q);void
glTexCoord{1,2,3,4}{d,f,i,s}v(const
TYP*v);4.Examples
:
windmill.cppSection7.
Curves
(1)1.Hermite
CurvesSection7.
Curves
(1)Section7.
Curves
Curves
(1)2.Spline
CurvesSection7.
Curves
(1)Section8.
Curves
(2)Section8.
Curves
(2)Section8.
Curves
(2)Section8.
Curves
(2)Section8.
Curves
(2)Section9.
Surfaces(1)Section9.
Surfaces(1)Section9.
Surfac
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 五人投资合同范本
- 副总入职合同范本
- 加盟装修公司合同范本
- 化工煤炭采购合同范本
- 关键岗位用工合同范本
- 产权车位交易合同范本
- 乙方专利合同范本
- 企标编制合同范本
- 业主施工安全合同范例
- 代加工木门合同范本
- LY/T 2749-2016桉树速丰林配方施肥技术规程
- GB/T 8427-1998纺织品色牢度试验耐人造光色牢度:氙弧
- GB/T 5130-1997电气用热固性树脂工业硬质层压板试验方法
- GB/T 2975-2018钢及钢产品 力学性能试验取样位置及试样制备
- GB/T 21254-2017呼出气体酒精含量检测仪
- 邀请函模板完整
- IP系列操作手册(中文)
- 建筑工地三级安全教育卡
- ID5S606B 600V高低侧栅极驱动芯片兼容PN7103-骊微电子
- 大学生人文知识竞赛报名表
- 单位工程质量检查与验收流程图
评论
0/150
提交评论