pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)NAME
pfNewFBState, pfGetFBStateClassType, pfFBStateStencilOp,
pfFBStateStencilFunc, pfFBStateStencilMask, pfGetFBStateStencilOp,
pfGetFBStateStencilFunc, pfGetFBStateStencilMask, pfFBStateBlendFunc,
pfGetFBStateBlendFunc, pfFBStateBlendEquation, pfGetFBStateBlendEquation,
pfFBStateBlendColor, pfGetFBStateBlendColor, pfFBStateDepthFunc,
pfFBStateDepthRange, pfGetFBStateDepthFunc, pfGetFBStateDepthRange,
pfFBStateDepthMask, pfGetFBStateDepthMask, pfFBStateColorMask,
pfGetFBStateColorMask, pfFBStateEnable, pfGetFBStateEnable,
pfFBStateColorMatrix, pfGetFBStateColorMatrix, pfFBStateShadeModel,
pfGetFBStateShadeModel, pfFBStatePixelBias, pfGetFBStatePixelBias,
pfFBStatePixelScale, pfGetFBStatePixelScale, pfFBStatePixelMap,
pfGetFBStatePixelMap, pfApplyFBState, pfFBStateMakeBasicState,
pfFBStateApplyBasicState - Create, modify, and query frame buffer state
objects
FUNCTION SPECIFICATION
#include <Performer/pr.h>
pfFBState* pfNewFBState(void *arena);
pfType* pfGetFBStateClassType(void);
void pfFBStateStencilOp(pfFBState* fbstate, GLenum stencilfail,
GLenum zfail, GLenum zpass);
void pfFBStateStencilFunc(pfFBState* fbstate, GLenum func,
GLint ref, GLuint mask);
void pfFBStateStencilMask(pfFBState* fbstate, GLuint mask);
void pfGetFBStateStencilOp(pfFBState* fbstate,
GLenum *stencilfail, GLenum *zfail, GLenum *zpass);
void pfGetFBStateStencilFunc(pfFBState* fbstate, GLenum *func,
GLint *ref, GLuint *mask);
void pfGetFBStateStencilMask(pfFBState* fbstate, GLuint *mask);
void pfFBStateBlendFunc(pfFBState* fbstate, GLenum sfactor,
GLenum dfactor);
void pfGetFBStateBlendFunc(pfFBState* fbstate, GLenum *sfactor,
GLenum *dfactor);
void pfFBStateBlendEquation(pfFBState* fbstate, GLenum mode);
void pfGetFBStateBlendEquation(pfFBState* fbstate, GLenum *mode);
void pfFBStateBlendColor(pfFBState* fbstate, GLfloat r,
GLfloat g, GLfloat b, GLfloat a);
Page 1
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)
void pfGetFBStateBlendColor(pfFBState* fbstate, GLfloat *r,
GLfloat *g, GLfloat *b, GLfloat *a);
void pfFBStateDepthFunc(pfFBState* fbstate, GLenum func);
void pfFBStateDepthRange(pfFBState* fbstate, GLclampd near,
GLclampd far);
void pfGetFBStateDepthFunc(pfFBState* fbstate, GLenum *func);
void pfGetFBStateDepthRange(pfFBState* fbstate, GLclampd *near,
GLclampd *far);
void pfFBStateDepthMask(pfFBState* fbstate, GLboolean flag);
void pfGetFBStateDepthMask(pfFBState* fbstate, GLboolean *flag);
void pfFBStateColorMask(pfFBState* fbstate, GLboolean r,
GLboolean g, GLboolean b, GLboolean a);
void pfGetFBStateColorMask(pfFBState* fbstate, GLboolean *r,
GLboolean *g, GLboolean *b, GLboolean *a);
void pfFBStateEnable(pfFBState* fbstate, GLenum mode, int flag);
void pfGetFBStateEnable(pfFBState* fbstate, GLenum mode,
int *flag);
void pfFBStateColorMatrix(pfFBState* fbstate, GLfloat *matrix);
void pfGetFBStateColorMatrix(pfFBState* fbstate,
GLfloat *matrix);
void pfFBStateShadeModel(pfFBState* fbstate, GLenum mode);
void pfGetFBStateShadeModel(pfFBState* fbstate, GLenum* mode);
void pfFBStatePixelBias(pfFBState* fbstate, GLfloat r, GLfloat g,
GLfloat b, GLfloat a);
void pfGetFBStatePixelBias(pfFBState* fbstate, GLfloat *r,
GLfloat *g, GLfloat *b, GLfloat *a);
void pfFBStatePixelScale(pfFBState* fbstate, GLfloat r,
GLfloat g, GLfloat b, GLfloat a);
void pfGetFBStatePixelScale(pfFBState* fbstate, GLfloat *r,
GLfloat *g, GLfloat *b, GLfloat *a);
void pfFBStatePixelMap(pfFBState* fbstate, GLenum which,
GLsizei size, GLfloat *pixmapValues);
Page 2
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)
void pfGetFBStatePixelMap(pfFBState* fbstate, GLenum which,
GLsizei *size, GLfloat *pixmapValues);
void pfApplyFBState(pfFBState* fbstate);
void pfFBStateMakeBasicState(pfFBState* fbstate);
void pfFBStateApplyBasicState(void);
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. Casting an object of
class pfFBState to an object of class pfObject is taken care of
automatically. This is also true for casts to objects of ancestor
classes 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 pfFBState can also be used with these
functions designed for objects of class pfMemory.
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);
Page 3
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)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
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
pfFBStateMakeBasicState 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.
pfFBStateStencilOp, pfFBStateStencilFunc, pfFBStateStencilMask correspond
to the OpenGL funcions glStencilOp, glStencilFunc, and glStencilMask.
These functions control the operation of the stencil buffer and the
stencil test.
pfFBStateBlendFunc, pfFBStateBlendEquation, pfFBStateBlendColor
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.
Page 4
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)
pfFBStateDepthFunc, pfFBStateDepthRange, and pfFBStateDepthMask control
the operation of the depth buffer. They correspond to the OpenGL
functions glDepthFunc, glDepthRange, and glDepthMask
pfFBStateColorMask controls which color channels in the frame buffer are
modified by rendering commands. This function corresponds to glColorMask
in OpenGL.
pfFBStateEnable 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:
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
pfFBStateColorMatrix 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>).
pfFBStateShadeModel is used to control whether OpenGL flat shades or
smooth shades triangles. The corresponding OpenGL function is
glShadeModel
pfFBStatePixelBias and pfFBStatePixelScale 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.
pfFBStatePixelMap 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.
pfApplyFBState 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.
Page 5
pfFBState(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfFBState(3pf)
pfFBStateMakeBasicState 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)
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
pfFBStateApplyBasicState 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
pfFBStateMakeBasicState followed by pfApplyFBState, except that no
pfFBState pointer is required. Performer calls this function at the
beginning of every frame.
SEE ALSO
pfShader, pfShaderManager
Page 6