PDA

View Full Version : what is c for glTexEnvi ?



cem polat
08-24-2004, 04:32 AM
In OpenGL Reference Manual 1.2, for the glTexEnv function a "c" color base internal is defined with the formula of

Av = AfIt

What is this c parameter? How can we build this c color value? Can anybody write a simple example for its usage?

sqrt[-1]
08-24-2004, 05:05 AM
Just looking quickly, I don;y think the "c" means anything in particular. I think it is just the "number of components" for GL_INTENSITY (ie no real number) (Look at GL_RGB with a 3 and GL_RGBA with a 4 in the table)

the Av= AfIt is the alpha part of a GL_INTENSITY texture processing.

dorbie
08-25-2004, 06:20 AM
From memory, these are just tables describing the fragment operations of the texture unit and they're the similar to the ones in the man page:

http://www.hmug.org/man/3/glTexEnviv.html

Basically the equations describe the output texture unit color and alpha given various inputs and modes.

When reading this understand that texture units really only have one output, the output of the texture operation as an rgba color. C is the output RGB color and A is the output alpha of this color.

Various inputs are the interpolated vertex color fragment and alpha fragment, texture fetch color and texture unit color. Other terms used like Lt or It on the input side just indicate a single component color from a different internal format and these typically get expanded to a color triplet for the color stuff.

So when the table says C = CtCf it means texture_unit_output_RGB_color = texture_color * interpolated_vertex_fragment_color

A = At would mean output_alpha = texture_alpha

There is a mistake in the manual I've posted a link to, Cv is never used, only C even though the manual says subscript v is used to denote texture unit output and it looks like that's used in the book from your post.

In the manual Cc and Ac describe a constant color associated with a texture environment specified with GL_TEXTURE_ENV_COLOR and C is the output color (probably Cv in your table).
You'd specify Cc and Ac together with:

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color_ptr);