中国高校课件下载中心 》 教学资源 》 大学文库

《计算机图形学》课程教学资源(PPT课件讲稿)Chapter 5 Attributes of Graphics Primitives

文档信息
资源类别:文库
文档格式:PPTX
文档页数:55
文件大小:3.14MB
团购合买:点击进入团购
内容简介
Part I. Color, point and line attributes OpenGL functions  OpenGL State Machine andVariables  Color and Gray Scale  OpenGL Color Functions  OpenGL Point-AttributeFunctions  OpenGL Line-Attribute Functions Part II. Fill-area methods and attributes OpenGL functions Part III. Character attributes and OpenGL functions
刷新页面文档预览

COIS712/ECOM708/C0IS800 Computer Graphics-Principles Systems Advanced Computer Graphics and Multimedia Advanced Computer Graphics& virtual Simulation Chapter 5 Attributes of Graphics Primitives

COIS712/ECOM708/COIS800 Computer Graphics – Principles & Systems Advanced Computer Graphics and Multimedia Advanced Computer Graphics & Virtual Simulation Chapter 5 Attributes of Graphics Primitives

Chapter 5 Attributes of Graphics Primitives Part I Color, point and line attributes Open gl functions

Chapter 5. Attributes of Graphics Primitives Part I. Color, point and line attributes OpenGL functions 2

Outline pen gL State Machine and variables Color and gray scale Open gl Color Functions Opengl point-Attribute Functions o Open gl Line-Attribute Functions

Outline  OpenGL State Machine andVariables  Color and Gray Scale  OpenGL Color Functions  OpenGL Point-AttributeFunctions  OpenGL Line-Attribute Functions 3

OpenGL State Machine State system(or state machine) o a graphics system that maintains a list for the current values of attributes and other parameters(state variables or state parameters) We assign a value to one or more state parameters, that is, we put the system into a certain state o The state will be persistent until we change the value of a state arameter to change to change State 3 State 1 State 2 to change

OpenGL State Machine 4 State 1 …… State 2 to change  State system (or state machine)  A graphics system that maintains a list for the current values of attributes and other parameters (state variables or state parameters).  We assign a value to one or more state parameters, that is, we put the system into a certain state.  The state will be persistent until we change the value of a state parameter. to change to change State 3

OpenGL State Machine o Open gL is a finite state machine predetermined and countable number of different states e The graphics system behaviors are determined by these system state, which can be modified by calling openGL functions The Open gl state includes e The current color or other attributes MatrixMode(GL PROJECTION) o The current model viewing transformations g denty( ) gluortho2D(…) The current camera model clipping e The current lighting reflectance mo ● The current viewport All have default values, remaining until a new setting on it

OpenGL State Machine  OpenGL is a finite state machine  A predetermined and countable number of different states  The graphics system behaviors are determined by these system state, which can be modified by calling OpenGL functions.  The OpenGL state includes:  The current color or other attributes  The current model & viewing transformations  The current camera model & clipping  The current lighting & reflectance model  The current viewport  All have default values, remaining until a new setting on it. … glMatrixMode (GL_PROJECTION); glLoadIdentity( ); gluOrtho2D( … ); … 5

OpenGL State Machine A common misconception imitive drawing functions are state changes o They are the output functions telling the system to draw something to the screen with the certain specified current state The options of the current state the current color gcor3f00.0.0.0.0); the current point size glPointSize(1.5) the depth function-enabled or not

OpenGL State Machine A common misconception  The primitive drawing functions are state changes  They are the output functions telling the system to draw something to the screen with the certain specified currentstate.  The options of the current state  the currentcolor  the current point size  the depth function - enabled or not  … glColor3f(0.0, 0.0, 0.0); glPointSize(1.5); 6

OpenGL State Machine e what do you do to maintain states and state variables b Opengl? To set states for drawing geometric primitives E. g: glPoint Size(size ) glLine Stipple(repeat, pattern g Shade Model(GL_SMOOtH) o or change(enable) states of how Open gl draws them o by default, most of these states are initially inactive Such states include: objects rendered with lighting, texturing, or undergo different processes, such as hidden surface removal, fog, and other states which affect the app Dearance Toturn on/off states glEnable(GL- lighting) diSable(gl ⊥ BLEND)

OpenGL State Machine  What do you do to maintain states and state variables by OpenGL?  To set states for drawing geometric primitives E.g: glPointSize ( size ); glLineStipple ( repeat, pattern ); glShadeModel ( GL_ SMOOTH);  or change (enable) states of how OpenGL draws them  By default, most of these states are initially inactive.  Such states include: objects rendered with lighting, texturing, or undergo different processes, such as hidden surface removal, fog, and other states, which affect the appearance.  To turn on/off states glEnable ( GL_ LIGHTING ); glDisable ( GL_BLEND); 7

Basic State Management void glEnable glenum capability void glDisable(GLenum capability) More than 60 enumerated values can be passed as parameters to them E.g: GL BLEND (controls blending of RGBa values) GL DEPTH TEST (controls depth comparisons and updates to the depth buffer) GL FOG (controls fo GL LINE STIPPLE atterned lines) GL LIGHTING ht effect

Basic State Management  E.g: GL_BLEND (controls blending of RGBA values) GL_DEPTH_TEST (controls depth comparisons and updates to the depth buffer) GL_FOG (controls fog) GL_LINE_STIPPLE (patterned lines) GL_LIGHTING (light effect) void glEnable (GLenum capability); void glDisable (GLenum capability);  More than 60 enumerated values can be passed as parameters to them. 8

Basic State Management Tocheck whether a state is currently enabled or disabled GLboolean glls Enabled(GLenum capability) o Returns gl true or gL false, depending on whether or not it is currently activated e For more complicated state variables, such as glColor 3f() set three values, which are part of the gl CUrrent color state Query routines: glGet*O

Basic State Management  To check whether a state is currently enabled or disabled by GLboolean glIsEnabled (GLenum capability)  Returns GL_TRUE or GL_FALSE, depending on whether or not it is currently activated.  For more complicated state variables, such as glColor3f ( ) set three values, which are part of the GL_CURRENT_COLOR state.  Query routines: glGet* (); 9

Basic State Management o Five querying routines void glGetBooleanv( GLenumpname, GLboolean*params void glGetIntegerv(GLenum pname, GLint*params); void glgetFloatv(GLenum pname, GLfloat *params void glGetDoublev(GLenumpname, GLdouble *params void glGetPointerv(GLenum pname, GLvoid**params pname: a symbolic constant indicating the state variable to return; E. g: GL_ CURRENT_ COLOR GL CURRENT NORMAL arms: a pointer to an array of the returned value

Basic State Management  Five querying routines void glGetBooleanv (GLenum pname, GLboolean *params); void glGetIntegerv (GLenum pname, GLint *params); void glGetFloatv (GLenum pname, GLfloat *params); void glGetDoublev (GLenum pname, GLdouble *params); void glGetPointerv (GLenum pname, GLvoid **params);  pname: a symbolic constant indicating the state variable to return; E.g.: GL_CURRENT_COLOR, GL_CURRENT_NORMAL  params: a pointer to an array of the returned value. 10

刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档