pfGeoArray man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

NAME
     pfGeoArray, pfVertexAttr - Create, modify and query geometry set objects
     that use vertex arrays

FUNCTION SPECIFICATION
     #include <Performer/pr/pfGeoArray.h>

		      pfGeoArray::pfGeoArray()

     static pfType*   pfGeoArray::getClassType(void);

     pfVertexAttr*    pfGeoArray::setAttr(pfGeoArray* _garray, int attrType,
			int size, GLenum type, GLenum stride, void *ptr);

     pfVertexAttr*    pfGeoArray::setMultiAttr(pfGeoArray* _garray,
			int attrType, int stage, int size, GLenum type,
			GLenum stride, void *ptr);

     int	      pfGeoArray::getNumAttrsOfType(int attrType) const;

     void	      pfGeoArray::removeAttr(pfVertexAttr *ai, int inst);

     void	      pfGeoArray::disableAttr(pfVertexAttr *ai, int inst);

     void	      pfGeoArray::enableAttr(pfVertexAttr *ai, int inst);

     void	      pfGeoArray::setIndexArray(unsigned int *iarray);

     unsigned int*    pfGeoArray::getIndexArray();

     void	      pfGeoArray::allowCache(int x);

     void	      pfGeoArray::updateData(void);

     int	      pfGeoArray::getNumAttrs() const;

     pfVertexAttr*    pfGeoArray::getNthArray(int n, int *inst) const;

     int	      pfGeoArray::isStandardArray(pfVertexAttr *ai,
			int *gtype, int *gindex);

     int	      pfGeoArray::getArrayMemSize(pfVertexAttr *ai, int inst,
			int *elemSize);

     void	      pfGeoArray::setDrawIndex(void);

     int	      pfGeoArray::XformAttr(GLenum clientState, int ptType,
			pfMatrix *xform);

     static void      pfGeoArray::setupCoords(pfGeoArray *dis);

									Page 1

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     static void      pfGeoArray::cleanupCoords(pfGeoArray *dis);

     pfVertexAttr*    pfVertexAttr::pfVertexAttr(pfGeoArray *parent,
			int attrType, void *arena);

     void	      pfVertexAttr::setAll(pfVertexAttr* _vattr, void *ptr,
			GLsizei stride, GLenum type, short size);

     void	      pfVertexAttr::setName(pfVertexAttr* _vattr, char *name);

     char*	      pfVertexAttr::getName(const pfVertexAttr* _vattr);

     pfFunc	      pfVertexAttr::getGLFunc(const pfVertexAttr* _vattr);

     GLenum	      -
		      pfVertexAttr::getClientState(const pfVertexAttr* _vattr);

     unsigned short   pfVertexAttr::getMask(const pfVertexAttr* _vattr);

     short	      pfVertexAttr::getInstance(const pfVertexAttr* _vattr);

     short	      pfVertexAttr::getMaskOff(const pfVertexAttr* _vattr);

     void	      pfVertexAttr::setPtr(pfVertexAttr* _vattr, void *data);

     void*	      pfVertexAttr::getPtr(const pfVertexAttr* _vattr);

     void	      pfVertexAttr::setStride(pfVertexAttr* _vattr,
			GLsizei stride);

     GLsizei	      pfVertexAttr::getStride(const pfVertexAttr* _vattr);

     void	      pfVertexAttr::setDataType(pfVertexAttr* _vattr,
			GLenum type);

     GLenum	      pfVertexAttr::getDataType(const pfVertexAttr* _vattr);

     void	      pfVertexAttr::setSize(pfVertexAttr* _vattr, short size);

     short	      pfVertexAttr::getSize(const pfVertexAttr* _vattr);

     int	      pfVertexAttr::copy(pfVertexAttr* _vattr,
			const pfVertexAttr *_src);

     int	      pfVertexAttr::compare(const pfVertexAttr* _vattr,
			const pfVertexAttr *_obj);

PARENT CLASS FUNCTIONS
     The OpenGL Performer class pfGeoArray is derived from the parent class
     pfGeoSet, so each of these member functions of class pfGeoSet are also
     directly usable with objects of class pfGeoArray.	This is also true for
     ancestor classes of class pfGeoSet.

									Page 2

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     void	       pfGeoSet::compile(void);
     void	       pfGeoSet::draw(void);
     void	       pfGeoSet::drawHlightOnly(void);
     void	       pfGeoSet::setNumPrims(int num);
     int	       pfGeoSet::getNumPrims(void);
     void	       pfGeoSet::setPrimType(int type);
     int	       pfGeoSet::getPrimType(void);
     void	       pfGeoSet::setPrimLengths(int *lengths);
     int *	       pfGeoSet::getPrimLengths(void);
     int *	       pfGeoSet::getPrimLength(int i);
     void	       pfGeoSet::setAttr(int attr, int bind, void *alist,
			 ushort *ilist);
     int	       pfGeoSet::getAttrBind(int attr);
     void	       pfGeoSet::getAttrLists(int attr, void **alist,
			 ushort **ilist);
     int	       pfGeoSet::getAttrRange(int attr, int *minIndex,
			 int *maxIndex);
     void	       pfGeoSet::setMultiAttr(int attr, int index, int bind,
			 void *alist, ushort *ilist);
     int	       pfGeoSet::getMultiAttrBind(int attr, int index);
     void	       pfGeoSet::getMultiAttrLists(int attr, int index,
			 void **alist, ushort **ilist);
     int	       pfGeoSet::getMultiAttrRange(int attr, int index,
			 int *minIndex, int *maxIndex);
     void	       pfGeoSet::setDrawMode(int mode, int val);
     int	       pfGeoSet::getDrawMode(int mode);
     void	       pfGeoSet::setDecalPlane(pfPlane *plane);
     pfPlane *	       pfGeoSet::getDecalPlane(int mode);
     void	       pfGeoSet::setGState(pfGeoState *gstate);
     pfGeoState *      pfGeoSet::getGState(void);
     void	       pfGeoSet::setGStateIndex(int id);
     int	       pfGeoSet::getGStateIndex(void);
     void	       pfGeoSet::setLineWidth(float width);
     float	       pfGeoSet::getLineWidth(void);
     void	       pfGeoSet::setPntSize(float size);
     float	       pfGeoSet::getPntSize(void);
     void	       pfGeoSet::setHlight(pfHighlight *hlight);
     pfHighlight *     pfGeoSet::getHlight(void);
     void	       pfGeoSet::setDrawBin(short bin);
     int	       pfGeoSet::getDrawBin(void);
     void	       pfGeoSet::setDrawOrder(unsigned int order);
     unsigned int      pfGeoSet::getDrawOrder(void);
     void	       pfGeoSet::hideStripPrim(int i);
     void	       pfGeoSet::unhideStripPrim(int i);
     int	       pfGeoSet::isStripPrimHidden(int i);
     int	       pfGeoSet::query(uint which, void* dst);
     int	       pfGeoSet::mQuery(uint* which, void* dst);
     void	       pfGeoSet::setBound(pfBox *bbox, int mode);
     int	       pfGeoSet::getBound(pfBox *bbox);
     void	       pfGeoSet::setBoundFlux(pfFlux *flux);

									Page 3

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     pfFlux*	       pfGeoSet::getBoundFlux(void);
     void	       pfGeoSet::setIsectMask(uint mask, int setMode,
			 int bitOp);
     uint	       pfGeoSet::getIsectMask(void);
     int	       pfGeoSet::isect(pfSegSet *segSet, pfHit **hits[]);
     void	       pfGeoSet::setPassList(pfPassList *passList_);
     pfPassList*       pfGeoSet::getPassList();
     void	       pfGeoSet::updateCteRefs(void);
     void	       pfGeoSet::calcTexBBox(void);
     void	       pfGeoSet::setTexBBox(uint centerS, uint centerT,
			 uint halfwidth, uint halfheight);
     void	       pfGeoSet::setTexBBox(float minS, float maxS,
			 float minT, float maxT);
     int	       pfGeoSet::getTexBBox(uint* centerS, uint* centerT,
			 uint* halfwidth, uint* halfheight);
     int	       pfGeoSet::getTexBBox(float* minS, float* maxS,
			 float* minT, float* maxT);
     void	       pfGeoSet::setCteAttr(int which, void* val);
     void*	       pfGeoSet::getCteAttr(int which);
     void	       pfGeoSet::setAppearance(islAppearance *appearance);
     islAppearance *   pfGeoSet::getAppearance(void);
     int	       pfGeoSet::isShaded(void);
     void	       pfGeoSet::quickCopy(pfGeoSet *src);
     void	       pfGeoSet::quickSetAttr(int _attr, void* _alist,
			 unsigned short* _ilist);
     void	       pfGeoSet::quickSetMultiAttr(int _attr, int _index,
			 void* _alist, unsigned short* _ilist);
     void	       pfGeoSet::quickSetPrimLengths(int *_lengths);
     void	       pfGeoSet::quickReset(int extRefOnly);
     void	       pfGeoSet::setOptimize(int _state);
     int	       pfGeoSet::getOptimize(void);
     int	       pfFluxedGSetInit(pfFluxMemory *fmem);

     Since the class pfGeoSet is itself derived from the parent class
     pfObject, objects of class pfGeoArray 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, 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 pfGeoArray can also be used with these
     functions designed for objects of class pfMemory.

									Page 4

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     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();

DESCRIPTION
     The pfGeoArray (short for "Geometry Array") is a new OpenGL Performer
     data structure aimed at replacing the existing pfGeoSet.  Conceptually,
     pfGeoArrays are very similar to pfGeoSets, but they allow the user to
     define new sets of attributes, in addition to the standard vertex
     coordinates, normals, texture coordinates, or colors.  These attributes
     can be used by vertex or fragment programs applied to the primitives (see
     pfVertexProgram and pfFragmentProgram).  Also, pfGeoArrays are rendered
     using vertex arrays and vertex objects making the rendering much more
     efficient. pfGeoArrays can be up to 10 times faster than pfGeoSets on
     Onyx4.

     Each pfGeoArray is a collection of geometry with one primitive type, such
     as points, lines, triangles.  Vertex coordinates, normals, colors,
     texture coordinates, and user defined attributes are used to specify the
     primitives.  There are two ways how the attributes are accessed. First,
     each attribute is specified per vertex, there is no notion of attribute
     per primitive or an overall attribute. Second, a single list of unsigned
     integers is used to index all attributes of a pfGeoArray.

     Indexing provides a more general mechanism for specifying geometry than
     hardwired attribute lists and in many cases provide a substantial memory
     savings due to shared attributes. Nonindexed pfGeoArrays's are sometimes
     easier to construct and may exhibit better caching behavior.  In our
     experience, though, indexing is often desirable approach, especially when
     your primitives share many vertices. Also, if you have a primitive with
     many triangle strips it is better to create a single pfGeoArray contating
     indexed triangles than to have a set of short pfGeoArrays, each
     containing one triangle strip.  The pfdOptimizeGraph functionality can be
     extremely useful for converting from pfGeoSet data to very fast
     pfGeoArray data.

									Page 5

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     new(arena) allocates a pfGeoArray from the specified memory arena, or
     from the process heap if arena is NULL.  new allocates a pfGeoArray from
     the default memory arena (see pfGetSharedArena).  Like other pfObjects,
     pfGeoArrays cannot be created statically, automatically on the stack or
     in arrays.	 pfGeoArrays should be deleted with pfDelete rather than the
     delete operator.

   pfGeoArray Attributes
     Attributes can be specified through the use of the pfGeoArray::setAttr
     and pfGeoArray::setMultiAttr functions.  These functions add or replace
     an attribute if it already exists. These take one of the following tokens
     for the attrType parameter:

	  PFGA_COORD_ARRAY
	  PFGA_NORMAL_ARRAY
	  PFGA_TEX_ARRAY
	  PFGA_COLOR_ARRAY
	  PFGA_COLOR2_ARRAY
	  PFGA_FOG_ARRAY
	  PFGA_WEIGHT_ARRAY
	  PFGA_GENERIC_ARRAY

     Some of these attributes require specific OpenGL extensions for their
     use.  The PFGA_COLOR2_ARRAY attribute requires the GL_ARB_secondary_color
     extension, the PFGA_FOG_ARRAY requires the GL_EXT_fog_coord extension,
     and the PFGA_WEIGHT_ARRAY attribute requires the GL_ARB_vertex_blend
     extension.	 The PFGA_GENERIC_ARRAY token indicates the use of generic
     attributes as described in the OpenGL GL_ARB_vertex_program extension.
     The location of some generic attributes overlap the locations of
     traditional attributes.  If multiple attributes share the same location,
     Performer does not attempt to fix this problem, and will simply use the
     most recently specified attribute.	 The PFGA_TEX_COORD_ARRAY,
     PFGA_GENERIC_ARRAY, and PFGA_WEIGHT_ARRAY attribute types may be
     specified with a non-zero stage parameter, indicating the texture unit,
     generic location, or weight unit to place the data.

     The size for an attribute type must be one of 2, 3 or 4. The data type is
     one of GL_DOUBLE, GL_FLOAT, GL_INT, GL_UNSIGNED_INT, GL_UNSIGNED_SHORT,
     GL_SHORT, GL_UNSIGNED_BYTE, and GL_BYTE.

     The setAttr functions return a pointer to a pfVertexAttr which contains
     the related data to the newly created attribute.  This data can be
     updated through the use of the pfVertexAttr interface.  The name, data
     pointer, stride, data type and size of an attribute can be modified using
     the following functions:

	  pfVertexAttr::setName
	  pfVertexAttr::setPtr
	  pfVertexAttr::setStride
	  pfVertexAttr::setDataType
	  pfVertexAttr::setSize

									Page 6

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     You can also remove an attribute using the function
     pfGeoArray::removeAttr.

     Multitexturing is supported by adding multiple PFGA_TEX_ARRAY vertex
     attributes and specifying different stages. For example:

	  pfGeoArray *gArray = new pfGeoArray();

	  gArray->setMultiAttr(PFGA_TEX_ARRAY, 0, 2, GL_FLOAT, 0, baseCoords);
	  gArray->setMultiAttr(PFGA_TEX_ARRAY, 1, 2, GL_FLOAT, 0, bumpCoords);

	  // set name for the two sets of tex coords we've just assigned
	  gArray->queryAttrType(PFGA_TEX_ARRAY, 0)->setName("base texture coords");
	  gArray->queryAttrType(PFGA_TEX_ARRAY, 1)->setName("bump texture coords");

     Additionally, a user can disable and enable attributes using the
     pfGeoArray::disableAttr and pfGeoArray::enableAttr functions.  These
     functions do not remove the attributes from the pfGeoArray, but simply
     disable and enable specific attributes for rendering.

     For convenience, the function pfGeoArray::getArrayMemSize is provided to
     quickly calculate the size in client memory the array of a data a single
     attribute consumes.  This does not neccesarily equal the amount of
     graphics memory the attribute uses, but gives the number of bytes from
     beginning to end that the pfGeoArray expects are used by the data array
     of an attribute.

     In OpenGL Performer 3.2, all of the methods used to set attributes such
     as vertex coords, colors, etc, can be used via the existing pfGeoSet
     interface. In that sense, replace a call from 'new pfGeoSet' with a call
     to new functionality. Note that indices will be copied if this happens
     because although pfGeoSets use unsigned shorts to store indices,
     pfGeoArrays use unsigned ints. Also, if more than one attribute for a
     geoset is specified with different indices then the attributes will be
     unrolled and the indices ignored.

     Also note that when using get methods which require a token which specify
     which attribute is requested, the token should be one of the pfGeoSet
     (and not pfGeoArray) tokens. For example:

	  int min, max;
	  pfGeoArray *gArray = ... ;

	  // this is ok:
	  gArray->getAttrRange(PFGS_COORD3, &min, &max);

	  // this is incorrect:
	  gArray->getAttrRange(PFGA_COORD_ARRAY, &min, &max);

									Page 7

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     In future releases of OpenGL Performer this problem will be resolved but
     with OpenGL Performer 3.2 a conflict exists between the tokens used for
     pfGeoSets and pfGeoArrays. The underlying principle to keep in mind is
     that when using methods which are defined in the pfGeoSet class use
     pfGeoSet tokens and when using methods defined only in pfGeoArray then
     use pfGeoArray tokens.

     Note that since the pfGeoArray attributes are rendered in the order they
     were added, it is possible to interleave the attributes with your own
     callbacks, by creating special "callback" type with a function mask 0 (no
     callback data), or function mask 0x1 (callback data are used).

     It is possible to index the attributes, although unlike in a pfGeoSet, a
     single index list is used for all attributes.  The optional attribute
     index list is a list of unsigned short integers. The index list is
     specified using the function pfGeoArray::setIndexArray.

     If attribute and index lists are allocated from the pfMalloc routines,
     pfGeoArray::setAttr and pfVertexAttr::setPtr will correctly update the
     reference counts of the lists.  Specifically, they will decrement the
     reference counts of the old lists and increment the reference counts of
     the new lists.  It will also free any lists whose reference counts reach
     0.	 When a pfGeoArray is deleted with pfDelete, all pfMalloc'ed lists
     will have their reference counts decremented by one and will be freed if
     their count reaches 0.

     When pfGeoArrays are copied with pfCopy, all pfMalloc'ed lists of the
     source pfGeoArray will have their reference counts incremented by one and
     those pfMalloc'ed lists of the destination pfGeoArray will have their
     reference counts decremented by one.  pfCopy copies lists only by
     reference (only the pointer is copied) and will not free any lists whose
     reference counts reach 0.

     Attribute data may be any of the following types of memory:

	  1.   Data allocated with pfMalloc. This is the usual, and
	       recommended memory type for pfGeoArray index and attribute
	       arrays.

	  2.   Static, malloc(), amalloc(), usmalloc() etc, data subsequently
	       referred to as non-pfMalloc'ed data.  This type of memory is
	       not generally recommended since it does not support reference
	       counting or other features provided by pfMalloc.	 In
	       particular, the use of static data is highly discouraged and
	       may result in segmentation violations.

	  3.   pfFlux memory.  In a pipelined, multiprocessing environment, a
	       pfFlux provides multiple data buffers which allow frame-
	       accurate data modifications to pfGeoArray attribute arrays like
	       coordinates (facial animation), and texture coordinates (ocean
	       waves, surf).  pfGeoArray::addAttr and pfGeoArray::setAttrPtr
	       and will accept a pfFlux* or pfFluxMemory* for the attribute

									Page 8

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

	       list (index lists do not support pfFlux) and the pfGeoArray
	       will select the appropriate buffer when rendered or intersected
	       with.  See pfFlux for more details.

	       Since pfGeoArrays are chached using vertex array objects, if
	       you want to animate some attributes, you need to either disable
	       caching using function pfGeoArray::allowCache or call the
	       function pfGeoArray::updateData each time you change any of the
	       attribute data.

	  4.   pfCycleBuffer and pfCycleMemory.	 However pfCycleBuffer has
	       been obsoleted by pfFlux.  See pfCycleBuffer for more details.

     Performer allows mixing pfMalloc'ed, pfFlux and pfCycleBuffer attributes
     on a single pfGeoArray.

   pfGeoArray Primitive Types
     Example 1:

	  /* Set up a non-indexed, TRISTRIP pfGeoArray */

	  garray = new pfGeoArray;
	  garray->setPrimType(PFGS_TRISTRIPS);
	  garray->setNumPrims(1);
	  lengths[0] = 4;
	  garray->setPrimLengths(lengths);

	  coords = (pfVec3*) pfMalloc(sizeof(pfVec3) * 4, NULL);
	  colors = (pfVec4*) pfMalloc(sizeof(pfVec4) * 4, NULL);

	  garray->setAttr(PFGA_COORD_ARRAY, 3, GL_FLOAT, 0, coords);
	  garray->setAttr(PFGA_COLOR_ARRAY, 4, GL_FLOAT, 0, colors);

     pfGeoArray::getClassType returns the pfType* for the class pfGeoArray.
     The pfType* returned by pfGeoArray::getClassType is the same as the
     pfType* returned by invoking the virtual function getType on any instance
     of class pfGeoArray.  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.

NOTES
     The following example shows one way to create a pfGeoArray defining a
     hexahedron, which is also known as a cube.

									Page 9

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

	  static pfVec3 coords[] =
	  {
	      {-1.0, -1.0,  1.0}, /* front */
	      { 1.0, -1.0,  1.0},
	      { 1.0,  1.0,  1.0},
	      {-1.0,  1.0,  1.0},

	      {-1.0, -1.0,  1.0}, /* left */
	      {-1.0,  1.0,  1.0},
	      {-1.0,  1.0, -1.0},
	      {-1.0, -1.0, -1.0},

	      {-1.0, -1.0, -1.0}, /* back */
	      {-1.0,  1.0, -1.0},
	      { 1.0,  1.0, -1.0},
	      { 1.0, -1.0, -1.0},

	      { 1.0, -1.0,  1.0}, /* right */
	      { 1.0, -1.0, -1.0},
	      { 1.0,  1.0, -1.0},
	      { 1.0,  1.0,  1.0},

	      {-1.0,  1.0,  1.0}, /* top */
	      { 1.0,  1.0,  1.0},
	      { 1.0,  1.0, -1.0},
	      {-1.0,  1.0, -1.0},

	      {-1.0, -1.0,  1.0}, /* bottom */
	      {-1.0, -1.0, -1.0},
	      { 1.0, -1.0, -1.0},
	      { 1.0, -1.0,  1.0}
	  };

	  static pfVec3 norms[] =
	  {
	      { 0.0,  0.0,  1.0},
	      { 0.0,  0.0,  1.0},
	      { 0.0,  0.0,  1.0},
	      { 0.0,  0.0,  1.0},

	      {-1.0,  0.0,  0.0},
	      {-1.0,  0.0,  0.0},
	      {-1.0,  0.0,  0.0},
	      {-1.0,  0.0,  0.0},

	      { 0.0,  0.0, -1.0},
	      { 0.0,  0.0, -1.0},
	      { 0.0,  0.0, -1.0},
	      { 0.0,  0.0, -1.0},

	      { 1.0,  0.0,  0.0},
	      { 1.0,  0.0,  0.0},

								       Page 10

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

	      { 1.0,  0.0,  0.0},
	      { 1.0,  0.0,  0.0},

	      { 0.0,  1.0,  0.0},
	      { 0.0,  1.0,  0.0},
	      { 0.0,  1.0,  0.0},
	      { 0.0,  1.0,  0.0},

	      { 0.0, -1.0,  0.0},
	      { 0.0, -1.0,  0.0},
	      { 0.0, -1.0,  0.0},
	      { 0.0, -1.0,  0.0}
	  };

	  // Convert static data to pfMalloc'ed data
	  static void*
	  memdup(void *mem, size_t bytes, void *arena)
	  {
	      void *data = pfMalloc(bytes, arena);
	      memcpy(data, mem, bytes);
	      return data;
	  }

	  /* Set up a PFGS_QUADS pfGeoArray */
	  garray = new pfGeoArray;
	  garray->setPrimType(PFGS_QUADS);
	  garray->setNumPrims(6);

	  garray->setAttr(PFGA_COORD_ARRAY, 3, GL_FLOAT, 0,
		    memdup(coords, sizeof(coords), NULL));
	  garray->setAttr(PFGA_NORMAL_ARRAY, 3, GL_FLOAT, 0,
		    memdup(norms, sizeof(norms), NULL));

     Unlike pfGeoSets we cannot index vertex coordinates and normals
     separately, resulting in a bigger memory requirements. The extra storage
     is worth the reduced rendering times, though.

     Another example of creating pfGeoArrays can be found in
     libpfdu/pfdConvertToGeoArrays.C and src/pguide/libpr/C++/geoArray.C.

   Converting pfGeoSets to pfGeoArrays
     Since using pfGeoArrays can be much faster on some platforms, such us
     Onyx4, you can convert your geometry from pfGeoSets to pfGeoArrays using
     two functions: pfdConvertGeoSetToGeoArray and
     pfdConvertNodeGeoSetsToGeoArrays. The first function converts an
     individial pfGeoSet into a pfGeoArray. The second function traverses a
     pfNode and replaces all its pfGeoSets to pfGeoArrays.  The parameter
     flags can be set to 0 or to PFD_CONVERT_TO_INDEXED_GEOARRAYS.  In the
     second case the loader tries to avoid the use of lengths array and it

								       Page 11

pfGeoArray(3pf)		      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     converts strips to indexed lines or triangles.

     Also, it is possible to use a pseudoloader .geoa to convert the geometry
     from pfGeoSets to pfGeoArrays during loading. The pseudoloader is used as
     follows: perfly file.ext.geoa. The pseudoloader calls
     pfdConvertNodeGeoSetsToGeoArrays with the flag
     PFD_CONVERT_TO_INDEXED_GEOARRAYS set. You can overwrite this default by
     setting the environment variable PFD_CONVERT_TO_INDEXED_GEOARRAYS to 0.

     NOTES

     On some hardware, the implementation of hardware cached vertex arrays may
     not be efficient.	In these cases, you may want to try to disable vertex
     buffer objects by setting environment variable
     PF_USE_VERTEX_BUFFER_OBJECTS to 0.	 On hardware that doesn't have support
     for the vertex_buffer_object or vertex_array_object extensions, while
     pfGeoArrays will still render correctly, they may not be as fast as
     rendering pfGeoSets, which are optimized for immediate mode rendering.

     Additionally, the rules for obtaining maximum performance with scene
     graphs involving pfGeoArrays can be different than those using pfGeoSets.
     For example, since unique pfGeoArrays will use different chunks of
     grahics memory, it is preferable to use instancing as much as possible.
     This implies that flattening scene graphs with instanced pfGeoArrays may
     actually hurt performance.

SEE ALSO
     pfGeoSet, pfApplyGState, pfColortable, pfCopy, pfCycleBuffer, pfDecal,
     pfDelete, pfDisable, pfDispList, pfEnable, pfFlux, pfFluxMemory,
     pfGeoState, pfHit, pfISL, pfLPointState, pfMalloc, pfMaterial,
     pfNewHlight, pfObject, pfOptimizeGraph, pfGSetIsectSegs, pfShadeModel,
     pfState, pfDispListOptimizer

								       Page 12

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net