pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
NAMEpfFBState - Create, modify, and query frame buffer state objects
FUNCTION SPECIFICATION
#include <Performer/pr/pfFBState.h>
pfFBState::pfFBState();
static pfType* pfFBState::getClassType();
void pfFBState::setStencilOp(GLenum stencilfail,
GLenum zfail, GLenum zpass);
void pfFBState::setStencilFunc(GLenum func, GLint ref,
GLuint mask);
void pfFBState::setStencilMask(GLuint mask);
void pfFBState::getStencilOp(GLenum *stencilfail,
GLenum *zfail, GLenum *zpass);
void pfFBState::getStencilFunc(GLenum *func, GLint *ref,
GLuint *mask);
void pfFBState::getStencilMask(GLuint *mask);
void pfFBState::setBlendFunc(GLenum sfactor, GLenum dfactor);
void pfFBState::getBlendFunc(GLenum *sfactor,
GLenum *dfactor);
void pfFBState::setBlendEquation(GLenum mode);
void pfFBState::getBlendEquation(GLenum *mode);
void pfFBState::setBlendColor(GLfloat r, GLfloat g,
GLfloat b, GLfloat a);
void pfFBState::getBlendColor(GLfloat *r, GLfloat *g,
GLfloat *b, GLfloat *a);
void pfFBState::setDepthFunc(GLenum func);
void pfFBState::setDepthRange(GLclampd near, GLclampd far);
void pfFBState::getDepthFunc(GLenum *func);
void pfFBState::getDepthRange(GLclampd *near, GLclampd *far);
void pfFBState::setDepthMask(GLboolean flag);
Page 1
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
void pfFBState::getDepthMask(GLboolean *flag);
void pfFBState::setColorMask(GLboolean r, GLboolean g,
GLboolean b, GLboolean a);
void pfFBState::getColorMask(GLboolean *r, GLboolean *g,
GLboolean *b, GLboolean *a);
void pfFBState::setEnable(GLenum mode, int flag);
void pfFBState::getEnable(GLenum mode, int *flag);
void pfFBState::setColorMatrix(GLfloat *matrix);
void pfFBState::getColorMatrix(GLfloat *matrix);
void pfFBState::setShadeModel(GLenum mode);
void pfFBState::getShadeModel(GLenum* mode);
void pfFBState::setPixelBias(GLfloat r, GLfloat g, GLfloat b,
GLfloat a);
void pfFBState::getPixelBias(GLfloat *r, GLfloat *g,
GLfloat *b, GLfloat *a);
void pfFBState::setPixelScale(GLfloat r, GLfloat g,
GLfloat b, GLfloat a);
void pfFBState::getPixelScale(GLfloat *r, GLfloat *g,
GLfloat *b, GLfloat *a);
void pfFBState::setPixelMap(GLenum which, GLsizei size,
GLfloat *pixmapValues);
void pfFBState::getPixelMap(GLenum which, GLsizei *size,
GLfloat *pixmapValues);
void pfFBState::apply();
void pfFBState::makeBasicState();
static void pfFBState::applyBasicState();
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfFBState is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfFBState. This is also true for
ancestor classes of class pfObject.
Page 2
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
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 pfFBState 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();
DESCRIPTION
A pfFBState encapsulates OpenGL modes which are used by the pfShader that
are not encapsulated by pfGeoState. pfFBState tracks mainly Frame Buffer
operations and OpenGL pixel transfer modes.
A pfFBState is mainly used to apply per-pass state in a pfShader
specification or it may be used to modify OpenGL state within a draw
callback. It is preferable to use pfFBState inside a draw callback rather
than direct OpenGL calls, since performer can track whatever state
changes pfFBState makes.
pfFBState modes can be either locally specified or inherited. When a
pfFBState is applied, any mode that it does not explicitly set will be
inherited from a global pfFBState. When pfFBStates are applied from
within shader passes, there are two notions of global state; the shader
default state which is common to all passes, and the global performer
pfFBState. Whichever modes are not explicitly specified by the local
Page 3
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
pfFBState are inherited from the pfShader default state. Whichever modes
are not set by either the local state or the pfShader default state will
be inherited from the global pfFBState. When applying pfFBStates inside a
draw callback, there is no shader default state, so any modes not
specified by the local state will be inherited from the global state.
Performer's global pfFBState can not be changed, it's fixed. See
pfFBState::makeBasicState() for a description of its state settings.
pfFBStates do not inherit state from each other, only from the global
state or the pfShader default state if it is present, so there is no need
to worry about OpenGL state leaking between successive pfFBState
applications.
All the pfFBState functions which get or set modes wrap OpenGL funcions
which perform the corresponding state change. The function descriptions
below list which OpenGL functions map to pfFBState functions. Please
consult the OpenGL manual pages for a detailed description of what these
functions do. Each of the functions in pfFBState takes the same
parameters as the corresponding OpenGL function.
Each set function has a corresponding get function which returns the
corresponding value, so the pfFBState accessor functions are not
documented in this page.
pfFBState::setStencilOp, pfFBState::setStencilFunc,
pfFBState::setStencilMask correspond to the OpenGL funcions glStencilOp,
glStencilFunc, and glStencilMask. These functions control the operation
of the stencil buffer and the stencil test.
pfFBState::setBlendFunc, pfFBState::setBlendEquation,
pfFBState::setBlendColor correspond to the OpenGL functions glBlendFunc,
glBlendEquationEXT, and glBlendColorEXT. They are used to control the way
incoming pixels are blended with those already in the frame buffer.
pfFBState::setDepthFunc,pfFBState::setDepthRange, and
pfFBState::setDepthMask control the operation of the depth buffer. They
correspond to the OpenGL functions glDepthFunc, glDepthRange, and
glDepthMask
pfFBState::setColorMask controls which color channels in the frame buffer
are modified by rendering commands. This function corresponds to
glColorMask in OpenGL.
pfFBState::setEnable controls which OpenGL modes are enabled and which
are disabled. For all modes except GL_MAP_COLOR, either glEnable or
glDisable will be called depending on the value of the second parameter.
For the GL_MAP_COLOR mode, glPixelTransferf will be used to turn pixel
maps on and off. The following modes are currently supported:
Page 4
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
GL_BLEND
GL_DEPTH_TEST
GL_STENCIL_TEST
GL_SAMPLE_ALPHA_TO_MASK_SGIS
GL_SAMPLE_ALPHA_TO_ONE_SGIS
GL_MAP_COLOR
GL_MULTISAMPLE_SGIS
GL_LINE_SMOOTH
GL_POINT_SMOOTH
pfFBState::setColorMatrix sets the currently active color matrix. The
color matrix is applied to all colors going through the OpenGL pixel
pipeline; texture downloads, framebuffer to texture copies and
framebuffer in-place copies. The color matrix is specified in OpenGL by
calling glMatrixMode(GL_COLOR) followed by glLoadMatrixf(<matrix>).
pfFBState::setShadeModel is used to control whether OpenGL flat shades or
smooth shades triangles. The corresponding OpenGL function is
glShadeModel
pfFBState::setPixelBias and pfFBState::setPixelScale set the pixel scale
and bias on pixel pipeline operations. These functions correspond to the
glPixelTransferf function call with GL_RED_SCALE, GL_RED_BIAS,
GL_GREEN_SCALE, GL_GREEN_BIAS, GL_BLUE_SCALE, GL_BLUE_BIAS,
GL_ALPHA_SCALE and GL_ALPHA_BIAS as the pname parameter.
pfFBState::setPixelMap controls the color lookup table which is applied
in the pixel transfer pipeline. When colors are generated during
rendering operations, their color can acutally be used as an index into
this lookup table which determines the color that is actually written
into the framebuffer. This function corresponds to the OpenGL function
glPixelMapfv.
pfFBState::apply is used to apply a pfFBState as the currently active
one. This function should be only called from within the draw process,
which is the only process guaranteed to have an OpenGL context active.
This function will apply all state elements that the specified pfFBState
modifies and will inherit the rest from the global pfFBState.
pfFBState::makeBasicState sets up the pfFBState it's invoked on to
represent the OpenGL state that performer has traditionally expected to
be applied for its standard unshaded rendering:
GL_DEPTH_TEST is enabled and set to GL_LEQUAL
GL_STENCIL_TEST is disabled
GL_BLEND is disabled
GL_SAMPLE_ALPHA_TO_MASK_SGIS is disabled
GL_SAMPLE_ALPHA_TO_ONE_SGIS is disabled
glColorMask is (GL_ONE, GL_ONE, GL_ONE, GL_ONE)
The color matrix is identity
glShadeModel is GL_SMOOTH
Pixel Scale is (1, 1, 1, 1)
Page 5
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages
Pixel Bias is (0, 0, 0, 0)
No pixel maps are specified and GL_MAP_COLOR is disabled
GL_MULTISAMPLE_SGIS is disabled
GL_POINT_SMOOTH and GL_LINE_SMOOTH are disabled
pfFBState::applyBasicState is a static function which is used to undo any
changes that pfFBState has made to the OpenGL state that Performer
traditionally expects. Using this function is equivalent to calling
pfFBState::makeBasicState followed by pfFBState::apply, except that no
pfFBState pointer is required. Performer calls this function at the
beginning of every frame.
SEE ALSO
pfShader, pfShaderManager
Page 6