pfTexEnv(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexEnv(3pf)NAME
pfTexEnv, pfGetCurTEnv - Create, modify and query texture environment
FUNCTION SPECIFICATION
#include <Performer/pr/pfTexture.h>
pfTexEnv::pfTexEnv();
pfType * pfTexEnv::getClassType(void);
void pfTexEnv::setMode(int mode);
int pfTexEnv::getMode(void);
void pfTexEnv::setBlendColor(float r, float g, float b, float a);
void pfTexEnv::getBlendColor(float* r, float* g, float* b,
float* a);
void pfTexEnv::apply(void);
pfTexEnv * pfGetCurTEnv(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfTexEnv is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfTexEnv. This is also true for
ancestor classes of class pfObject.
void* pfObject::operator new(size_t);
void* pfObject::operator new(size_t, void *arena);
void* pfObject::operator new(size_t, pfFluxMemory *fmem);
void pfObject::setUserData(void *data);
void pfObject::setUserData(int slot, void *data);
void* pfObject::getUserData(pfObject *obj);
void* pfObject::getUserData(pfObject *obj, int slot);
int pfObject::getNumUserData();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfTexEnv can also be used with these functions
designed for objects of class pfMemory.
void* pfMemory::getData(const void *ptr);
pfType * pfMemory::getType();
int pfMemory::isOfType(pfType *type);
int pfMemory::isExactType(pfType *type);
const char * pfMemory::getTypeName();
int pfMemory::copy(pfMemory *src);
int pfMemory::compare(const pfMemory *mem);
Page 1
pfTexEnv(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexEnv(3pf)
void pfMemory::print(uint which, uint verbose, char *prefix,
FILE *file);
int pfMemory::getArena(void *ptr);
void* pfMemory::getArena();
int pfMemory::ref();
int pfMemory::unref();
int pfMemory::unrefDelete();
int pfMemory::unrefGetRef();
int pfMemory::getRef();
int pfMemory::checkDelete();
int pfMemory::isFluxed();
void * pfMemory::getArena();
int pfMemory::getSize();
DESCRIPTIONnew(arena) allocates a pfTexEnv from the specified memory arena, or from
the heap if arena is NULL. new allocates a pfTexEnv from the default
memory arena (see pfGetSharedArena). Like other pfObjects, pfTexEnvs
cannot be created statically, automatically on the stack or in arrays.
pfTexEnvs should be deleted with pfDelete rather than the delete
operator. See the OpenGL glTexEnv(3g) man page for more details on
texture environments.
pfTexEnv::getClassType returns the pfType* for the class pfTexEnv. The
pfType* returned by pfTexEnv::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfTexEnv. Because OpenGL Performer allows subclassing of built-in
types, when decisions are made based on the type of an object, it is
usually better to use the member function isOfType to test if an object
is of a type derived from a Performer type rather than to test for strict
equality of the pfType*'s.
pfTexEnv::setMode sets the texture environment mode. mode is a symbolic
token that specifies a texture environment mode and is one of the
following:
PFTE_MODULATE
PFTE_BLEND
PFTE_DECAL
PFTE_REPLACE
PFTE_ADD
PFTE_ALPHA
The default mode is PFTE_MODULATE. pfTexEnv::getMode returns the mode of
the pfTexEnv. See the OpenGL glTexEnvf(3g) man page for more details on
texture environments.
npfTexEnv::setBlendColor sets the texture environment blend color. This
color is used when the texture environment mode is PFTE_BLEND or
PFTE_ADD. The default OpenGL Performer texture environment blend color
is [1,1,1,1]. It is different from the default OpenGL blend color of
[0,0,0,0]. This was done to maintain compatibility with previous OpenGL
Page 2
pfTexEnv(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexEnv(3pf)
Performer releases. pfTexEnv::getBlendColor copies the texture
environment blend color into r, g, b, a.
pfTexEnv::apply makes the pfTexEnv the current texture environment. When
texturing is enabled (see below), this texture environment will be
applied to all geometry drawn after pfTexEnv::apply is called. Only one
pfTexEnv may be active at a time although many may be defined.
Modifications to the pfTexEnv, such as changing the blend color, will not
have effect until pfTexEnv::apply is called.
For geometry to be textured, the following must be true:
1. Texturing must be enabled: pfEnable(PFEN_TEXTURE)
2. A pfTexEnv must be applied: pfTexEnv::apply
3. A pfTexture must be applied: pfTexture::apply
4. Geometry must have texture coordinates: pfGeoSet::setAttr,
PFGS_TEXCOORD2
The texture environment state element is identified by the PFSTATE_TEXENV
token. Use this token with pfGeoState::setAttr to set the texture
environment of a pfGeoState and with pfOverride to override subsequent
texture environment changes.
Example 1:
/* Set up blue 'blend' texture environment */
tev = new pfTexEnv;
tev->setMode(PFTE_BLEND);
tev->setBlendColor(0.0f, 0.0f, 1.0f);
/* Set up textured/blended pfGeoState */
gstate->setMode(PFSTATE_ENTEXTURE, PF_ON);
gstate->setAttr(PFSTATE_TEXENV, tev);
gstate->setAttr(PFSTATE_TEXTURE, tex);
/* Attach gstate to gset */
gset->setGState(gstate);
/* Set texture coordinate array. 'gset' is non-indexed */
gset->setAttr(PFGS_TEXCOORD2, PFGS_PER_VERTEX, tcoords, NULL);
/* Draw textured gset */
gset->draw();
Example 2:
Page 3
pfTexEnv(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexEnv(3pf)
tev->apply();
/* Override so that all textured geometry uses 'tev' */
pfOverride(PFSTATE_TEXENV, PF_ON);
pfTexEnv::apply is a display-listable command. If a pfDispList has been
opened by pfDispList::open, pfTexEnv::apply will not have immediate
effect but will be captured by the pfDispList and will only have effect
when that pfDispList is later drawn with pfDispList::draw.
pfGetCurTEnv returns the currently active pfTexEnv or NULL if there is no
active pfTexEnv.
NOTES
PFTE_ALPHA is supported only on RealityEngine graphics systems.
SEE ALSO
pfDelete, pfDispList, pfEnable, pfGeoState, pfObject, pfState, pfTexture,
tevbind, tevdef, texbind, texdef, glTexEnv, glTexImage2D.
Page 4