Open GL Super Bible:The OpenGL State Machine
To access the contents, click the chapter and section titles.
Open GL Super Bible
(Publisher: Macmillan Computer Publishing)
Author(s): Waite group Press
ISBN: 1571690735
Publication Date: 08/01/96
Previous
Table of Contents
Next
Stencil Buffer States
The stencil buffer supports many special effects, including shadows. Like the depth buffer, however, the stencil buffer is very easy to control. Save stencil buffer state information with glPushAttrib(GL_STENCIL_BUFFER_BIT). which saves the current GL_STENCIL_TEST value.
Lighting States
Of all the OpenGL features, lighting has the most OpenGL state information. The state information for lighting includes the current lighting environment (model) settings for color and lighting mode; material definitions; the color, position, and direction of light; and other parameters. Moreover, OpenGL adds even more state information with automatic lighting normal generation.
Table 14-3 lists all the available variables. At the very minimum, you’ll need to call glEnable(GL_LIGHTING) and glEnable(GL_LIGHT0). To save the current lighting state, call glPushAttrib(GL_LIGHTING_BIT | GL_EVAL_BIT).
Table 14-3 Lighting State Variables
State Variable
Description
GL_AUTO_NORMAL
Automatically generate lighting normals from glMap parameters.
GL_COLOR_MATERIAL
Assign material colors from the current drawing color.
GL_LIGHTING
Enable lighting calculations.
GL_LIGHTx
Enable lighx.
GL_MAP1_NORMAL
Enable mapping of lighting normals from 1D coordinates.
GL_MAP2_NORMAL
Enable mapping of lighting normals from 2D coordinates.
GL_NORMALIZE
Normalize all lighting normals prior to doing calculations.
Texturing States
In terms of complexity, texturing in OpenGL is second only to lighting. Table 14-4 lists the available variables.
Table 14-4 Texturing State Variables
State Variable
Description
GL_MAP1_TEXTURE_COORD_1
The s texture coordinate will be generated by calls to glEvalPoint1, glEvalMesh1, and glEvalCoord1.
GL_MAP1_TEXTURE_COORD_2
The s and t texture coordinates will be generated by calls to glEvalPoint1, glEvalMesh1, and glEvalCoord1.
GL_MAP1_TEXTURE_COORD_3
The s, t, and r texture coordinates will be generated by calls to glEvalPoint1, glEvalMesh1, and glEvalCoord1.
GL_MAP1_TEXTURE_COORD_4
The s, t, r, and q texture coordinates will be generated by calls to glEvalPoint1, glEvalMesh1, and glEvalCoord1.
GL_MAP2_TEXTURE_COORD_1
The s texture coordinate will be generated by calls to glEvalPoint2, glEvalMesh2, and glEvalCoord2.
GL_MAP2_TEXTURE_COORD_2
The s and t texture coordinates will be generated by calls to glEvalPoint2, glEvalMesh2, and glEvalCoord2.
GL_MAP2_TEXTURE_COORD_3
The s, t, and r texture coordinates will be generated by calls to glEvalPoint2, glEvalMesh2, and glEvalCoord2.
GL_MAP2_TEXTURE_COORD_4
The s, t, r, and q texture coordinates will be generated by calls to glEvalPoint2, glEvalMesh2, and glEvalCoord2.
GL_TEXTURE_1D
Enable 1D texturing unless 2D texturing is enabled.
GL_TEXTURE_2D
Enable 2D texturing.
GL_TEXTURE_GEN_Q
Automatically generate the q texture coordinate from calls to glVertex.
GL_TEXTURE_GER
Automatically generate the r texture coordinate from calls to glVertex.
GL_TEXTURE_GEN_S
Automatically generate the s texture coordinate from calls to glVertex.
GL_TEXTURE_GEN_T
Automatically generate the t texture coordinate from calls to glVertex.
To save the current texturing parameters, call glEnable with GL_TEXTURE_BIT and GL_EVAL_BIT. When you’re enabling texturing, make sure to enable onlone of the texturing modes—either GL_TEXTURE_1D or GL_TEXTURE_2D. The OpenGL spec states that 2D texturing overrides 1D texturing, but some implementations do not comply with this.
Pixel States
Pixel transfer, storage, and mapping modes are probably the least understood and least optimized OpenGL features. Save them with a call to glPushAttrib(GL_PIXEL_BIT). There are no glEnable states for these modes.
Previous
Table of Contents
Next
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.
Wyszukiwarka
Podobne podstrony:
467 0722 01 2011 TEST B PSYCHOLOGIA S2id)467467 1109 (465)467 05467 ac467 SKiTI LABDesafina bossanova instr 3 46 d47 465465 473467 1408 (465)465 Ewidencja podwyższenia kapitału zakładowego w drodze konwersji pożyczki na udziały467 10więcej podobnych podstron