Lecture 9
Lecture 9
glClear(GL_DEPTH_BUFFER_BIT |
GL_COLOR_BUFFER_BIT);
Hidden Surface Removal
Modeling an object about its local origin involves defining it in terms of:
1.modeling coordinates
2.eye coordinates
3.euclidean coordinates
4.modeling transformations
hat is a 'depth buffer' and what does it accumulate?
Generally - what primitive polygon is used for creating a mesh to represent a complex object?
Triangle
Rectangle
Switches to material mode to add visual effects.
Square
Circle
Once shading is enabled - what happens to glColor() calls?
They are ignored.
They enhance the shading effects.
To scale a section of a buffer.
They function as normal.
A run-time error occurs if both are used.
When do you use glFlush and glFinish?
Yes
You use glFlush to clear the screen and glFinish to draw the screen to the display.
glFlush and glFinish should be called once and only once per application. Their utility has increased
over time and is required for any OpenGL application no matter how simple (a three line demo) or
complex (a 450 - 000 AAA video game).
glShader(ProgramID);
Usually around certain operations - such as during a glReadPixel after writing - or when OpenGL
must flush or finish its currently buffered calls. Their utility has decreased over time.
Ambient lighting comes from light that is so scattered there is no way to tell its original
location
The diffuse component of lighting is light that comes from one direction.
Once it hits a surface, it is scattered equally in all directions
Lighting Properties:
A light source is characterized by the amount of red, green, & blue light it emits.
If R=G=B=.5, the color is still white, but only at half intensity, so it appears gray.
properties
Colors for ambient, diffuse, & specular components
position and type
attenuation
i goes from 0 to 7
Types of Lights
Light
Light color
color properties
properties
GL_AMBIENT
GL_AMBIENT
GL_DIFFUSE
GL_DIFFUSE
GL_SPECULAR
GL_SPECULAR
Turning
glEnable — enableon the
or disable Lights
server-side GL capabilities glGet or glIsEnabled
GL_ALPHA_TEST
Both glEnable and glDisable take a single argument
.If enabled, do alpha testing
GL_DEPTH_TEST
GL_LIGHTi
GL_TEXTURE_2D
Creating the light source Two-dimensional texturing is performed for the active texture unit.
Basic Lighting
Creating Light Sources .Light sources have a number of properties, such as color, position, and direction
GL_SPOT_EXPONENT GL_SPOT_CUTOFF
GL_LIGHT_MODEL_COLOR_CONTROL
GL_LIGHT_MODEL_LOCAL_VIEWER
GL_LIGHT_MODEL_TWO_SIDE
3 kind of lights
a positional light source. This kind of light emits light from a particular location
(define by the property : GL_POSITION) and emits ray in all direction.
A directional light emits light from an infinite distance. The ray emitted are all
parallel and have the same direction (defined by the property GL_POSITION).
glMaterial takes three arguments. The first, face, specifies whether the GL_FRONT materials, the GL_BACK materials, or
both GL_FRONT_AND_BACK materials will be modified.
The second, pname, specifies which of several parameters in one or both sets will be modified.