dmuGLPBuffer
Inherits from: dmuLatch
#include "dmuGLPBuffer.h"
Overview
The dmuGLPBuffer class is intended as a base class for any
dmu object that wants to receive and manipulate DMbuffer data as an
Open GL Pixel Buffer. See glXCreateGLXPbufferSGIX (3G) for
more information on OGL PBuffers. This class creates a PBuffer,
with no pixel area associated with it. The parameters for the
PBuffer are based on the dmu constraints obtained through the dmu
chain initialization (the init() process - see Overview).
As the parent of the object sends new frame data, the
dmuGLPBuffer keeps a reference to the last (most recent) frame
received. Access to the data is obtained through the grab()
method. Grab() associates the latest frame data as the pixel area
of the PBuffer (calls glXAssociateDMPbufferSGIX). This PBuffer can
now be used with any Open GL operations which are valid with
PBuffers (for example, defining textures, reading and writing
pixels, etc.). The DMBuffer remains associated with the PBuffer,
and a valid pixel store for OGL operations until release()
is called on the object. Grab() is a blocking call, so you must
call release() after every grab() call. Two grab calls in a row will
cause indefinite blocking
This class is intended as a base class, and should not be
instantiated directly. Either instantiate a class that inherits
from this, or create your own subclass to gain access to the
pbuffer and dmbuffers. The dmuGLTex2d object is a good example of
how to create your own object that inherits from dmuGLPBuffer.
See the source code for more info and implementation details.
Public Methods
- dmuGLPBuffer()
Constructs and initialization of member variables.This class is
intended as a base class, and should not be instantiated
directly.
- ~dmuGLPBuffer()
Destroys the object, and the PBuffer that is associated with
the object.
- int setup(Display *theDisplay, int width, int height)
Setup is called to set all the variables that are needed to
create the PBuffer and the DMbuffers that are going to be used in
the object. theDisplay is a pointer to the X Display of
the application. Width and height specify the size of the
pixel area that to be created. This should be the same as the
size of a single frame of data that will be passed to it from
its parent object. Future implementations should detect
the size constraints automatically, but for now, they have to
be set explicitly by the user process.
- virtual int init(dmuParams *params = NULL)
Constructs the PBuffer based on the chain constraints and the
setup() variables. This is usually not called explicitly
unless this object is at the head of the dmu chain. Otherwise,
init() is called from the parent's init() function.
- virtual int grab()
This method locks the latest data from the parent object, and
associates it as the pixel area of the PBuffer. This sets the
object up to perform OpenGL operations on the PBuffer, using the
latest data received from the parent. Note that grab() is
a blocking call, and should always be followed by a matching call
to release() when the object is finished with the PBuffer.
- int addSrcConstraints(DMparams *params)
If this class is acting as a destination for another object in a
chain, this method is used to notify the parent object (i.e. the
source object) of any constraints which the video path may have
on its source. These constraints are added to the params
parameter structure. addSrcConstraints() is ususally called
internally in the library during the init() method of the parent
object. It is rarely, if ever, used by user programs.
- int addDstConstraints(DMparams *params)
Currently this method is unimplemented
- GLXFBConfigSGIX getFBConfig()
returns the frame buffer config.
Overview Object List Object Hierarchy
Sample Apps