Download presentation
Presentation is loading. Please wait.
1
Draw a Simple Object
2
Outline Course Map OpenGL Example Functions’ Introduction
3
Fixed Pipeline Per-Vertex Operations Viewport culling & clipping
Vertex pipeline Per-Vertex Operations Viewport culling & clipping Primitive assembly Rasterize Pixel pipeline Fragment Processing Per Fragment operations Frame Buffer operations Framebuffer
4
Course Map Transformation & Lighting Viewport culling & clipping
We are here! Vertex pipeline Transformation & Lighting Viewport culling & clipping Primitive assembly Rasterize Pixel pipeline Texture blending Per Fragment operations Frame Buffer operations Framebuffer
5
Example 1/3
6
Example 2/3
7
Example 3/3
8
Result
9
Data Type
10
Clear the Buffers 1/2 void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); Set the current values for use in cleaning color buffers in RGBA mode red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the color buffers are cleared void glClearDepth(GLdouble depth); Set the current values for use in cleaning depth buffer depth: Specifies the depth value used when the depth buffer is cleared
11
Clear the Buffers 2/2 void glClear(GLbitfield mask);
Clear the specified buffers to their current clearing values mask: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT, GL_STENCIL_BUFFER_BIT EX: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
12
Color Representation RGBA: red, green, blue, alpha
Each channel has intensity from 0.0~1.0 Values outside this interval will be clamp to 0.0 or 1.0 Alpha is used in blending and transparency Specify a color: void glColor{34}{sifd}[v](…); EX: glColor3f(1.0f, 0.0f, 0.0f);
13
Points, Lines and Polygons 1/4
Describe points, lines, polygons void glBegin(GLenum mode); Marks the beginning of a vertex-data list Vertex-data include vertex’s color, normal, position, etc. mode: can be any of the values in next page void glEnd(); Marks the end of a vertex-data list
14
Points, Lines and Polygons 2/4
15
Points, Lines and Polygons 3/4
16
Points, Lines and Polygons 4/4
Specifying the vertices void glVertex{234}{sifd}[v](…) Specifies a vertex for use in describing a geometric object You have to set vertex’s attributes before glVertex Ex: Use glColor before glVertex to set the vertex’s color Can only effective between a glBegin() and glEnd() pair
17
Completion of Drawing void glFlush(); void glFinish();
Forces previously issued OpenGL commands to begin execution. void glFinish(); Forces previous issued OpenGL commands to complete. void glutSwapBuffers(); Swap front and back buffers.
18
Thanks for listening! Any questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.