dmuGLTex2d
Inherits from: dmuGLPBuffer
#include "dmuGLTex2d.h"
Overview
The dmuGLTex2d class inherits from dmuGLPBuffer, and
implements the functionality needed to use the latest data that
has been receive from the parent object as a texture map in
subsequent OpenGL operations. See the dmuGLPBuffer class for
more details on how dmuGLPBuffers work.
The dmuGLTex2d object takes care of the grab() and
release() method calls on the dmuGLPBuffer. These are
wrapped in the defineTex2D method. The typical usage
scenario of dmuGLTex2d looks something like this:
Construct (and name) a dmuObject that will be used as the data
source for the dmuGLTex2d object
Construct (and name) a dmuGLTex2d object
Wire the object into the dmu chain
Call setup() on the dmuGLTex2d object using parameters
obtained from the application (theDisplay) and from the parent
object (imageSizeX, imageSizeY) Make sure the image dimensions are
powers of 2.
Start up the dmu chain (using start() at the head of the
chain), and enter the normal handle events loop. See the Overview
for more information.
When the application wants to render a scene (after knowing
that the parent of the dmuGLTex2d has gotten at least one valid
frame of data), call defineTex2D. This grabs the latest
data, and sets up openGL to use the data as the current texture
map. (This data will be valid until the next call to
defineTex2D.)
Render the scene. Repeat the previous step whenever the
application wants to render the scene (this often happens in a
separate thread from the dmu handleEvents loop).
See the source code for more info and implementation details.
Public Methods
- dmuGLTex2d()
Perform normal dmuGLPBuffer construction
- ~dmuGLTex2d()
Perform normal dmuGLPBuffer destruction
- int defineTex2D()
This method release()'s any DMbuffer that it may have
grab()'ed. It then calls grab() to lock and
associated the latest DMbuffer data and associate it with the
PBuffer. Finally this method sets up the data in the PBuffer to
be used as the texture map source for all subsequent OGL
rendering operations (when texturing is enabled). To achieve
this setup, it sets the current GLX readable to be the PBuffer,
and leaves the current GLXDrawable and context alone. It then
makes a call to glCopyTexSubImage2DEXT which tells GL to use the
curent readable as the source for the texture map. The texture
stays valid until a new one is defined, or until the user program
calls glXMakeCurrent or glXMakeCurrentReadSGI to set the context
and readable differently
Overview Object List Object Hierarchy
Sample Apps