pfTexGen(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexGen(3pf)NAME
pfTexGen, pfGetCurTGen - Create, modify and query texture coordinate
generator
FUNCTION SPECIFICATION
#include <Performer/pr/pfTexture.h>
pfTexGen::pfTexGen();
pfType * pfTexGen::getClassType(void);
void pfTexGen::setMode(int texCoord, int mode);
int pfTexGen::getMode(int texCoord);
void pfTexGen::setPlane(int texCoord, float x, float y, float z,
float d);
void pfTexGen::getPlane(int texCoord, float* x, float* y,
float* z, float* d);
void pfTexGen::setPoint(int texCoord, float x, float y, float z,
float dx, float dy, float dz);
void pfTexGen::getPoint(int texCoord, float* x, float* y,
float* z);
void pfTexGen::apply(void);
pfTexGen* pfGetCurTGen(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfTexGen is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfTexGen. 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 pfTexGen can also be used with these functions
designed for objects of class pfMemory.
Page 1
pfTexGen(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexGen(3pf)
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);
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();
PARAMETERS
texCoord identifies a texture coordinate and is one of:
PF_S, PF_T, PF_R, PF_Q
DESCRIPTION
The pfTexGen capability is used to automatically generate texture
coordinates for geometry, typically for special effects like projected
texture, reflection mapping, and for light points (pfLPointState).
new(arena) allocates a pfTexGen from the specified memory arena, or from
the heap if arena is NULL. new allocates a pfTexGen from the default
memory arena (see pfGetSharedArena). Like other pfObjects, pfTexGens
cannot be created statically, automatically on the stack or in arrays.
pfTexGens should be deleted with pfDelete rather than the delete
operator.
pfTexGen::getClassType returns the pfType* for the class pfTexGen. The
pfType* returned by pfTexGen::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfTexGen. 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.
pfTexGen::setMode sets the mode of the pfTexGen corresponding to texture
coordinate texCoord to mode. mode must be one of the following:
Page 2
pfTexGen(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexGen(3pf)
PFTG_OFF
Disables texture coordinate generation
PFTG_OBJECT_LINEAR
Generate texture coordinate as distance from plane in object
space.
PFTG_EYE_LINEAR
Generate texture coordinate as distance from plane in eye
space. The plane is transformed by the inverse of the ModelView
matrix when the pfTexGen is applied.
PFTG_EYE_LINEAR_IDENT
Generate texture coordinate as distance from plane in eye
space. The plane is not transformed by the inverse of the
ModelView matrix.
PFTG_SPHERE_MAP
Generate texture coordinate based on the view vector reflected
about the vertex normal in eye space.
PFTG_OBJECT_DISTANCE_TO_LINE
Coordinate will be the distance in object space from the vertex
to a line specified with a point and direction vector through
pfTGenPoint.
PFTG_EYE_DISTANCE_TO_LINE
Coordinate will be the distance in eye space from the eye to a
line specified with pfTGenPoint through the vertex.
PFTG_REFLECTION_MAP
Set texture coordinate to the view vector reflected about the
vertex normal in eye space.
PFTG_NORMAL_MAP
Set texture coordinate to the vertex normal in eye space.
See the OpenGL glTexGen(3g) man page for the specific mathematics of the
texture coordinate generation modes.
The default texture generation mode for all texture coordinates is
PFTG_OFF. pfTexGen::getMode returns the mode of the pfTexGen.
pfTexGen::setPlane sets the plane equation used for generating
coordinates for texture coordinate texCoord to aX + bY + cZ + d = 0. This
plane equation is used when the pfTexGen's mode is PFTG_EYE_LINEAR,
PFTG_EYE_LINEAR_IDENT, or PFTG_OBJECT_LINEAR but is ignored when its mode
is PFTG_SPHERE_MAP, PFTG_REFLECTION_MAP, or PFTG_NORMAL_MAP. The default
plane equations are:
PF_S: (1, 0, 0, 0)
Page 3
pfTexGen(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexGen(3pf)
PF_T: (0, 1, 0, 0)
PF_R: (0, 0, 1, 0)
PF_Q: (0, 0, 0, 1)
pfTexGen::getPlane will return the plane equation parameters for texture
coordinate texCoord of the pfTexGen in x, y, z, d. (If any of those
arguments are NULL, they will be ignored.)
pfTexGen::setPoint sets a point and possible direction vector for use
with point and line based texture generation functions.
pfTexGen::getPoint will return the point of the pfTexGen in x, y, z.
pfTexGen::apply configures the graphics hardware with the texture
coordinate generating parameters encapsulated by the pfTexGen. Only the
most recently applied pfTexGen is active although any number of pfTexGen
definitions may be created. Texture coordinate generation must be
enabled (pfEnable(PFEN_TEXGEN)) for the pfTexGen to have effect and
modifications made to the pfTexGen do not have effect until the next time
pfTexGen::apply is called. pfGetCurTGen returns the currently active
pfTexGen.
The pfTexGen state element is identified by the PFSTATE_TEXGEN token.
Use this token with pfGeoState::setAttr to set the pfTexGen attribute of
a pfGeoState and with pfOverride to override subsequent pfTexGen
changes.:
Example 1:
/* Set up pfGeoState */
gstate->setMode(PFSTATE_ENTEXGEN, PF_ON);
gstate->setAttr(PFSTATE_TEXGEN, new pfTexGen);
/* Attach gstate to gset */
gset->setGState(gstate);
/* Draw pfGeoSet whose texture coordinates are generated */
gset->draw();
Example 2:
/* Override so that all geometry is affected by 'tgen' */
pfEnable(PFEN_TEXGEN);
tgen->apply();
pfOverride(PFSTATE_TEXGEN | PFSTATE_ENTEXGEN, PF_ON);
pfTexGen::apply is a display-listable command. If a pfDispList has been
Page 4
pfTexGen(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfTexGen(3pf)
opened by pfDispList::open, pfTexGen::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.
SEE ALSO
pfDelete, pfDispList, pfGeoState, pfLPointState, pfMemory, pfObject,
pfOverride, texgen, glTexGen.
Page 5