pfFragmentProgram(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
NAMEpfFragmentProgram - class for specifying vertex programs
FUNCTION SPECIFICATION
#include <Performer/pr/pfFragmentProgram.h>
pfFragmentProgram::pfFragmentProgram();
pfType * pfFragmentProgram::getClassType(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. This
is also true for ancestor classes of class pfGProgram.
pfType * pfGProgram::getClassType(void);
int pfGProgram::loadProgram(const char *filename);
void pfGProgram::setProgram(const char *code);
void pfGProgram::setProgram(const char *code, int length);
void pfGProgram::getProgram(char **code);
int pfGProgram::getProgramLength();
int pfGProgram::getNativeProgramLength();
int pfGProgram::isValid();
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* 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 pfFragmentProgram 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);
Page 1
pfFragmentProgram(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
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 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 method pfFragmentProgram::setProgram. The first
parameter is the string defining the program. Optionally, 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
pfFragmentProgram::loadProgram.
You can apply the pfFragmentProgram using pfFragmentProgram::apply, but
only in the draw process. Once the pfFragmentProgram has been applied,
you can query its state using the following methods:
pfFragmentProgram::getProgramLength, which return the number of
instructions of the program, pfFragmentProgram::getNativeProgramLength,
which returns the number of instructions used by the specific GPU, and
Page 2
pfFragmentProgram(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
pfFragmentProgram::isValid, 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