pfVertexProgram(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages
NAME
pfNewVertexProgram, pfGetVertexProgramClassType - class for specifying
vertex programs
FUNCTION SPECIFICATION
#include <Performer/pr.h>
pfVertexProgram* pfNewVertexProgram(void *arena);
pfType* pfGetVertexProgramClassType(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfVertexProgram is derived from the parent
class pfGProgram, so each of these member functions of class pfGProgram
are also directly usable with objects of class pfVertexProgram. Casting
an object of class pfVertexProgram to an object of class pfGProgram is
taken care of automatically. This is also true for casts to objects of
ancestor classes of class pfGProgram.
int pfGProgramLoadProgram(pfGProgram* _gprogram,
const char *filename);
void pfGProgramProgram(pfGProgram* gprog, const char *code);
void pfGProgramProgramLen(pfGProgram* gprog, const char *code,
int length);
void pfGetGProgramProgram(const pfGProgram* gprog, char **code);
int pfGetGProgramProgramLength(pfGProgram* gprog);
int pfGetGProgramNativeProgramLength(pfGProgram* gprog);
int pfGProgramIsValid(pfGProgram* gprog);
void pfGProgramApply(pfGProgram* gprog);
Since the class pfGProgram is itself derived from the parent class
pfObject, objects of class pfVertexProgram can also be used with these
functions designed for objects of class pfObject.
void pfUserDataSlot(pfObject *obj, int slot, void *data);
void pfUserData(pfObject *obj, void *data);
void* pfGetUserDataSlot(pfObject *obj, int slot);
void* pfGetUserData(pfObject *obj);
int pfGetNumUserData(pfObject *obj);
int pfGetNamedUserDataSlot(const char *name);
const char* pfGetUserDataSlotName(int slot);
int pfGetNumNamedUserDataSlots(void);
int pfGetGLHandle(pfObject *obj);
int pfDeleteGLHandle(pfObject *obj);
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfVertexProgram can also be used with these
functions designed for objects of class pfMemory.
Page 1
pfVertexProgram(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages
pfType * pfGetType(const void *ptr);
int pfIsOfType(const void *ptr, pfType *type);
int pfIsExactType(const void *ptr, pfType *type);
const char * pfGetTypeName(const void *ptr);
int pfRef(void *ptr);
int pfUnref(void *ptr);
int pfUnrefDelete(void *ptr);
int pfUnrefGetRef(void *ptr);
int pfGetRef(const void *ptr);
int pfCopy(void *dst, void *src);
int pfDelete(void *ptr);
int pfIsFluxed(void *ptr);
int pfCompare(const void *ptr1, const void *ptr2);
void pfPrint(const void *ptr, uint which, uint verbose,
FILE *file);
void * pfGetArena(void *ptr);
DESCRIPTION
The pfVertexProgram is a class derived from the class pfGProgram. The
class does not add any new method. Vertex programs are used by the GPU
to modify various parameters of each vertex. GPU is a programmable
graphics processing unit of a modern graphics hardware, used for example
in Onyx4. This GPU allows the user to specify a sequence of floating-
point 4-component operations that are executed for each vertex. These
operations transform an input set of per-vertex parameters to a set of
per-vertex result parameters.
A vertex program replaces the standard OpenGL set of lighting and texture
coordinate generation modes. Consequently the vertex program has to take
care of the basic transformation of vertex coordinates to the screen
coordinates, generating texture coordinatets, and applying the lighting
equation. On the other hand, this allows the user to modify the position
of each vertex, producing, for example, a displacement mapping. A
description of vertex program instruction set is beyond the scope of this
man page. You can find it in OpenGL extension registry at
http://oss.sgi.com/projects/ogl-sample/registry/ under
GL_ARB_vertex_program.
A pfVertexProgram is a sequence of assembly-like instructions that are
specified in a string, with new line character separating each
instruction, or from a text file. If the program is specified in a
string, you use methods pfGProgramProgram and pfGProgramProgramLen. In
the second method you can specify the length, in case you want to load
only part of the string. If the program is loaded from a text file, you
use the method pfGProgramLoadProgram.
You can apply the pfVertexProgram using pfGProgramApply, but only in the
draw process. Once the pfVertexProgram has been applied, you can query
its state using the following methods: pfGetGProgramProgramLength, which
return the number of instructions of the program,
pfGetGProgramNativeProgramLength, which returns the number of
Page 2
pfVertexProgram(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages
instructions used by the specific GPU, and pfGProgramIsValid, which
returns 1 if the program has been successfully loaded into the GPU.
A pfVertexProgram is set and enabled in a pfGeoState. The user parameters
for vertex programs can be defined using the class pfGProgramParms. See
the pfGProgramParms man page and the sample code in
/usr/share/Performer/src/pguide/libpf/C++/gprogram.C.
SEE ALSO
pfGProgram, pfFragmentProgram, pfGProgramParms, pfGeoState, pfTexture,
pfObject.
Page 3