Open GL Super Bible:Visual Effects:nBlending and Fog
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
Summary
Blending and fog complete the OpenGL library and are yet another source for making the images you generate more realistic. Blending provides transparency effects and improves anti-aliasing of points, lines, and polygons. Fog supports a variety of depth-cueing and weather effects that make images look less exact and, ironically, more like the real world.
Reference Section
glBlendFunc
Purpose
Sets color blending functions.
Include File
<GL/gl.h>
Syntax
void glBlendFunc(GLenum sfactor, GLenum dfactor);
Description
This function sets the source and destination
blending factors for color blending. You must call glEnable(GL_BLEND) to
enable color blending. Blending is only available in RGBA drawing
contexts. The default settings for blending are glBlendFunc(GL_ONE,
GL_ZERO).
Parameters
sfactor
GLenum: The source colorłs blending function.
dfactor
GLenum: The destination pixel colorłs blending function.
Returns
None.
Example
See the example in CH16\BLENDPOT.C on the CD.
glFog
Purpose
Specifies fog parameters.
Include File
<GL/gl.h>
Syntax
void glFogf(GLenum pname, GLfloat param);
void glFogfv(GLenum pname, GLfloat *params);
void glFogi(GLenum pname, GLint param);
void glFogiv(GLenum pname, GLint *params);
Description
The glFog functions
set fog parameters. To draw using fog you must call glEnable(GL_FOG).
Parameters
pname
GLenum: The parameter to set. Valid names are as
follows:
GL_FOG_COLOR
The color of the fog; must be an array of 4 numbers representing the RGBA color.
GL_FOG_DENSITY
The fog density; a number greater than 0.0. The density is only used for the GL_EXP and GL_EXP2 fog modes.
GL_FOG_END
The farthest distance to which the fog is applied. This is a transformed Z (depth) value from 0.0 to 1.0.
GL_FOG_MODE
The fog type; specifies the formula used to render fog effects
(GL_LINEAR, GL_EXP, or GL_EXP2).
GL_FOG_START
The closest distance to which fog is applied. This is a
transformed Z (depth) value from 0.0 to 1.0.
param
GLfloat, GLint: The parameter value.
params
GLfloat *, GLint *: A pointer to the parameter array.
Returns
None.
Example
See the example in CH16\FOGSCENE.C on the CD.
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:
kosiarka solo 530 531 532 532pHeidenhain frezarka iTNC 530 G kody pl532 (2)Instrukcja GECO Z 530 1 S v04 w01 POLreadme (532)instrukcja obsługi urządzenia Trak GPS 530 po polsku530 2004 petrol YES532 (3)530 2003 petrol NOreadme (530)więcej podobnych podstron