pfFragmentProgram(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages
NAME
pfNewFragmentProgram, pfGetFragmentProgramClassType - class for
specifying vertex programs
FUNCTION SPECIFICATION
#include <Performer/pr.h>
pfFragmentProgram* pfNewFragmentProgram(void *arena);
pfType* pfGetFragmentProgramClassType(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfFragmentProgram is derived from the parent
class pfGProgram, so each of these member functions of class pfGProgram
are also directly usable with objects of class pfFragmentProgram.
Casting an object of class pfFragmentProgram 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 pfFragmentProgram 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 pfFragmentProgram can also be used with these
functions designed for objects of class pfMemory.
Page 1
pfFragmentProgram(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 pfFragmentProgram is a class derived from the class pfGProgram. The
class does not add any new method. Fragment programs are used by the GPU
to modify various parameters of each fragment, pixel rendered. 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
fragment. These operations transform an input set of per-fragment
parameters are transformed to a set of per-fragment result parameters.
A fragment program replaces the standard OpenGL set of texture and fog
application modes. Consequently the vertex program has to take care of
accessing the textures and modulating the resulting color according to
the fog equation, if necessary. On the other hand, this allows the user
to modify the resulting color and depth of each pixel, making it
possible, for example, to apply a complex per-pixel shading. A
description of fragment 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_fragment_program.
A pfFragmentProgram 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 pfFragmentProgram using pfGProgramApply, but only in
the draw process. Once the pfFragmentProgram 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
pfFragmentProgram(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 pfFragmentProgram 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, pfVertexProgram, pfGProgramParms, pfGeoState, pfTexture,
pfObject.
Page 3