Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members Related Pages
sglTexEnv Class Reference
#include <sglTexEnv.hpp>
Inheritance diagram for sglTexEnv::
List of all members.
Public Types |
enum | ModeEnum {
eDECAL = GL_DECAL,
eREPLACE = GL_REPLACE,
eMODULATE = GL_MODULATE,
eADD = GL_ADD,
eBLEND = GL_BLEND,
eCOMBINE = GL_COMBINE
} |
Public Methods |
| sglTexEnv () |
virtual | ~sglTexEnv () |
void | setMode (ModeEnum mode) |
ModeEnum | getMode () const |
void | setBlendColor (float r, float g, float b, float a) |
void | getBlendColor (float &r, float &g, float &b, float &a) const |
void | setCombinerParams (sglTexCombinerParams *params) |
sglTexCombinerParams* | getCombinerParams () const |
void | setLODBias (float bias) |
float | getLODBias () const |
void | applyToUnit (sglCurrState *curr_state, unsigned int unit) const |
virtual bool | getSorted () const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Detailed Description
This statelet encapsulates OpenGL's glTexEnv*() functions which sets the texturing function for any subsequent textured geometry that is rendered. These functions affect how the texture interacts with the underlying colors in the polygons to which it is being applied. This statelet also encapsulates an ever expanding set of extensions (if available) that add new texturing functions:
- GL_ARB_texture_env_add (or GL_EXT_texture_env_add).
- GL_EXT_texture_lod_bias.
- GL_ARB_texture_env_dot3
- GL_ARB_texture_env_combine
Example:
sglTexEnv *tenv = new sglTexEnv;
tenv->setBlendColor(1.0f, 0.7f, 0.0f, 1.0f);
tenv->setMode(sglTexEnv::eBLEND);
if (sgl::s_texture_lod_bias_capable)
{
tenv->setLODBias(sgl::s_max_texture_lod_bias); // maximum
}
Definition at line 64 of file sglTexEnv.hpp.
Member Enumeration Documentation
|
Tokens for the various texture environment modes.
-
Enumeration values:
-
eDECAL
|
Uses texture color. Only works with RGB and RGBA textures. |
eREPLACE
|
Uses texture color, uses face alpha if texture format doesn't include alpha. Works with all internal texture formats. |
eMODULATE
|
Modulates texture color with face color. |
eADD
|
Adds the face color to the texture color (if extension is available). See sgl::s_texture_env_add_capable. |
eBLEND
|
Blends the face with a blend color, and uses the face's color value somewhat like an alpha value to perform the blending. |
eCOMBINE
|
The texel color is computed from a combination of multiple inputs (if extension is available). See sgl::s_texture_env_combine_capable. |
Definition at line 68 of file sglTexEnv.hpp. |
Constructor & Destructor Documentation
|
Default constructor. The mode defaults to eMODULATE (the OpenGL default). |
sglTexEnv::~sglTexEnv (
|
) [virtual]
|
|
Member Function Documentation
void sglTexEnv::setMode (
|
ModeEnum mode )
|
|
|
Set the texture function. -
Parameters:
-
mode
|
One of the ModeEnum tokens. If eADD or eCombine is specified but is not supported through the extensions, then eMODULATE will be used instead. The default value is eMODULATE. |
|
ModeEnum sglTexEnv::getMode (
|
) const [inline]
|
|
|
Query the current texture function. -
Returns:
-
The ModeEnum token corresponding to the current texture function.
Definition at line 119 of file sglTexEnv.hpp. |
void sglTexEnv::setBlendColor (
|
float r,
|
|
float g,
|
|
float b,
|
|
float a )
|
|
|
Set the blend color to be used if the texture function is eBLEND, or eCOMBINE with an eCONSTANT source parameter. -
Parameters:
-
r
|
The red component of the blend color. |
g
|
The green component of the blend color. |
b
|
The blue component of the blend color. |
a
|
The alpha component of the blend color. |
|
void sglTexEnv::getBlendColor (
|
float & r,
|
|
float & g,
|
|
float & b,
|
|
float & a ) const
|
|
|
Query the current blend color. -
Parameters:
-
r
|
On return, contains the red component of the blend color. |
g
|
On return, contains the green component of the blend color. |
b
|
On return, contains the blue component of the blend color. |
a
|
On return, contains the alpha component of the blend color. |
|
|
Set the parameters to use for the eCOMBINE mode. If params is set to NULL and eCOMBINE has been selected, eMODULATE will be used instead. -
Parameters:
-
params
|
The combiner parameters. |
|
|
Get the parameters used for the eCOMBINE mode. @erturn The combiner parameters.
Definition at line 148 of file sglTexEnv.hpp. |
void sglTexEnv::setLODBias (
|
float bias )
|
|
|
Set the texture LOD bias which can affect which mipmap levels are chosen This is only available if the GL_EXT_texture_lod_bias extension is available; otherwise this factor is ignored. -
Parameters:
-
bias
|
The bias value in the range [-sgl::s_max_texture_lod_bias .. sgl::s_max_texture_lod_bias]. Values outside this range will be clamped. |
|
float sglTexEnv::getLODBias (
|
) const [inline]
|
|
|
Query the current LOD bias factor. -
Returns:
-
The current LOD bias factor.
Definition at line 163 of file sglTexEnv.hpp. |
void sglTexEnv::applyToUnit (
|
sglCurrState * curr_state,
|
|
unsigned int unit ) const [virtual]
|
|
|
Apply this state change to the current rendering state for the given texture unit. -
Parameters:
-
curr_state
|
Required for statelets that affect one another. For example the sglTransparency sets up depth mask and blending modes which interact with the sglBlending and sglDepthMask statelets, and the curr_state object is used to resolve these internal issues. |
unit
|
Index for the texture unit (0 is the first). |
Reimplemented from sglTexturingStatelet. |
bool sglTexEnv::getSorted (
|
) const [inline, virtual]
|
|
|
Query the sorting mode for this statelet. -
Returns:
-
true if this type of statelet should be sorted by pointer rather than using m_index to index into an array. The defualt implementation is the latter, but if a statelet can take on an inordinate number of states (e.g. a floating point parameter) then true should be returned.
Reimplemented from sglStatelet.
Definition at line 169 of file sglTexEnv.hpp. |
virtual void sglTexEnv::printInfo (
|
ostream & ostrm,
|
|
const char * indent_string ) const [virtual]
|
|
|
Output the state of this node to the specified ostream. -
Parameters:
-
ostrm
|
the ostream to which the output is sent |
indent_string
|
the string (usually spaces) that is output at the beginning of every line of output |
Reimplemented from sglStatelet. |
The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:10 2002 for SGL by
1.2.6 written by Dimitri van Heesch,
© 1997-2001