Download presentation
Presentation is loading. Please wait.
Published byRolf Chase Modified over 9 years ago
1
Lecture 7 Midterm Review
2
OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture mipmaps from a base image, draw quadric surfaces and NURBS. glut: OpenGL Utility Toolkit library. A system independent windowing system. Hierarchical view of libraries: http://www.nigels.com/glt/doc/gl_8h.html
3
Mesa 3D Mesa 3D is a free/open source implementation of OpenGL. Mesa 3D This is a good source if you plan to see the implementation details of a function. http://www.mesa3d.org
4
Rendering Pipeline
5
Evaluators Deriving vertices from basis functions Vertices can be used to represent a surface Per-Vertex Operations Converts vertices into primitives i.e. line, polygon, etc. Does mathematical operations, i.e. transformation, rotation, projection, etc.
6
Rendering Pipeline Rasterization: Conversion of geometric and pixel data into fragments. Each fragment corresponds to a pixel in frame buffer. When creating models, many parameters have to be considered, e.g. shading model, color, point size, etc.
7
Fragment Operations Before a fragment be placed in frame buffer, the following can be controlled: Texture Mapping Fog calculations Alpha Test, depth buffer test Blending, masking, etc.
8
GLUT Window Initialization What is Buffer? Clearing the Window glClearColor(R, G, B, A) glClearColor(GL_COLOR_BUFFER_BIT) glClearDepth() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
9
OpenGL Buffers
10
Event Driven Programming Definition. A programming where the primary activity is reaction to the receipt of event. Applications: GUI, HCI Ingredients: Events: Can be from any source, human input, e.g. mouse or other sensors. Event Dispatcher: Assigns events to event handlers. Event Handler
11
Event Processing in GLUT Initial Setup: Initializing Display Modes, e.g. Color mode, Single/Double Buffer, etc. Entering GLUT event processing loop void glutMainLoop (void)
12
Display Function The display function of current window When is it called? If the normal plane of a window needs to be redisplayed as a result of window damage. GLUT determines this based on redisplay state of a window. When a user requests. How is it called? Implicitly: By GLUT, e.g. when the window system reports a region of the window's normal plane is undefined (for example, damaged by another window moving or being initially shown) Explicitly: Using glutPostRedisplay function.
13
Double Buffering Using Two buffers Front Buffer Back Buffer Is specified in initialization step glutInitDisplayMode (GLUT_DOUBLE) Replace glFlush() with glSwapBuffers() Increases the performance It’s NOT free, you have to pay: memory
14
Rotation and Translation
15
Camera Rotation Example: If we want to move a camera along a circular path and about any one of axes, we use rotation matrix corresponding to that axis. Then, by increasing the angle from [0…360], we calculate the new location of the camera.
16
ModelView,Projection,Viewport ModelView: Rotation, Translation, Scale. Projection: glFrustum, glOrtho, glPerspective Viewport glViewport
17
Perspective Projection
18
Viewport Defines how a rendered image should be displayed on a window.
19
Sequence of Matrices
20
Camera Properties: Position, Direction, UpVector Attention: Using gluLookAt affects the ModelView Matrix It is usually placed at the beginning of the display function It is usually placed after glLoadIdentity(GL_MODELVIEW) Be careful when placing it in a loop.
21
Matrix Stack Pushing matrices into the stack Poping matrices from the stack Example:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.