pfText(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfText(3pf)NAMEpfText - Create, modify, and query a 3D text node.
FUNCTION SPECIFICATION
#include <Performer/pf/pfText.h>
pfText::pfText();
static pfType * pfText::getClassType(void);
int pfText::addString(pfString* string);
int pfText::removeString(pfString* str);
int pfText::insertString(int index, pfString* str);
int pfText::replaceString(pfString* old, pfString* new);
pfString * pfText::getString(int index);
int pfText::getNumStrings(const pfString* string);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfText is derived from the parent class
pfNode, so each of these member functions of class pfNode are also
directly usable with objects of class pfText. This is also true for
ancestor classes of class pfNode.
pfGroup * pfNode::getParent(int i);
int pfNode::getNumParents(void);
void pfNode::setBound(pfSphere *bsph, int mode);
int pfNode::getBound(pfSphere *bsph);
pfNode* pfNode::clone(int mode);
pfNode* pfNode::bufferClone(int mode, pfBuffer *buf);
int pfNode::flatten(int mode);
int pfNode::setName(const char *name);
const char * pfNode::getName(void);
pfNode* pfNode::find(const char *pathName, pfType *type);
pfNode* pfNode::lookup(const char *name, pfType* type);
int pfNode::isect(pfSegSet *segSet, pfHit **hits[]);
void pfNode::setTravMask(int which, uint mask, int setMode,
int bitOp);
uint pfNode::getTravMask(int which);
void pfNode::setTravFuncs(int which, pfNodeTravFuncType pre,
pfNodeTravFuncType post);
void pfNode::getTravFuncs(int which, pfNodeTravFuncType *pre,
pfNodeTravFuncType *post);
void pfNode::setTravData(int which, void *data);
void * pfNode::getTravData(int which);
void pfNode::setTravMode(int which, int mode, int val);
Page 1
pfText(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfText(3pf)
int pfNode::getTravMode(int which, int mode) const;
Since the class pfNode is itself derived from the parent class pfObject,
objects of class pfText can also be used with these functions designed
for objects of class pfObject.
void* pfObject::operator new(size_t);
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 pfText 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);
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
string identifies a pfString.
DESCRIPTION
A pfText is analogous to a pfGeode. A pfText encapsulates pfStrings in a
scene graph as a pfGeode encapsulates pfGeoSets. A pfText is a leaf node
in the OpenGL Performer scene graph hierarchy and is derived from pfNode
so it can use pfNode API. A pfText is simply a list of pfStrings.
The bounding volume of a pfText is that which surrounds all its
pfStrings. Unless the bounding volume is considered static (see
Page 2
pfText(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfText(3pf)
pfNode::setBound), OpenGL Performer will compute a new volume when the
list of pfStrings is modified by pfText::addString, pfText::removeString,
pfText::insertString or pfText::replaceString. If the bounding box of a
child pfString changes, call pfNode::setBound to tell OpenGL Performer to
update the bounding volume of the pfText.
new pfText creates and returns a handle to a pfText. Like other pfNodes,
pfTexts are always allocated from shared memory and cannot be created
statically, on the stack or in arrays. pfTexts should be deleted using
pfDelete rather than the delete operator.
pfText::getClassType returns the pfType* for the class pfText. The
pfType* returned by pfText::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfText. 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.
pfText::addString appends str to the pfText's pfString list.
pfText::removeString removes str from the list and shifts the list down
over the vacant spot. For example, if str had index 0, then index 1
becomes index 0, index 2 becomes index 1 and so on. pfText::removeString
returns a 1 if str was actually removed and 0 if it was not found in the
list. pfText::addString and pfText::removeString will cause OpenGL
Performer to recompute new bounding volumes for the pfText unless it is
configured to use static bounding volumes.
pfText::insertString will insert str before the pfString with index
index. index must be within the range 0 to pfText::getNumStrings().
pfText::replaceString replaces old with new and returns 1 if the
operation was successful or 0 if old was not found in the list.
pfText::insertString and pfText::replaceString will cause OpenGL
Performer to recompute new bounding volumes for the pfText unless it is
configured to use static bounding volumes.
pfText::getNumStrings returns the number of pfStrings in the pfText.
pfText::getString returns a handle to the pfString with index index or
NULL if the index is out of range.
Here is a sample code snippet demonstrating how to use pfText, pfFont,
and pfString to add 3D text to a scene graph:
/* Initialize Performer and create pfScene "scene" */
/* Get shared memory arena */
arena = pfGetSharedArena();
/* Append standard directories to Performer search path, PFPATH */
pfFilePath(".:/usr/share/Performer/data");
Page 3
pfText(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfText(3pf)
/* Create 3D message and place in scene. */
text = new pfText;
scene->addChild(text);
if (pfFindFile("Times-Elfin.of", path, R_OK))
{
str = new pfString;
str->setMode(PFSTR_DRAWSTYLE, PFSTR_EXTRUDED);
str->setMode(PFSTR_JUSTIFY, PFSTR_MIDDLE);
str->setColor(1.0f, 0.0f, 0.8f, 1.0f);
str->setString("Welcome to OpenGL Performer");
str->flatten();
text->addString(str);
}
else
{
pfNotify(PFNFY_WARN,PFNFY_PRINT,"Couldn't find font file.");
exit(0);
}
SEE ALSO
pfGeoSet, pfNode, pfString, pfFont, pfDelete
Page 4