torque Torque Game Engine Documentation
TGE Version 1.5.2

DynamicTexture Class Reference

#include <gDynamicTexture.h>


Public Member Functions

 DynamicTexture ()
 Default Constructor.
 DynamicTexture (const RectI &updateRect)
 Constructor.
 DynamicTexture (GuiControl *control)
 Gui updater Constructor.
 ~DynamicTexture ()
 Destructor.
void update ()
 Grabs the rectangle defined by mUpdateRect from the color-buffer and sticks it in the texture.
void registerForGuiUpdates (GuiControl *control)
 This registers this DynamicTexture to be updated every frame with the contents of a GuiControl.
bool unregisterForGuiUpdates ()
 This will unregister this DynamicTexture from per-frame Gui updates.
void registerForScreenUpdates ()
 This will register this DynamicTexture to be updated every frame.
bool unregisterForScreenUpdates ()
 This will unregister this control from screen updates.
void updateAtEndOfFrame ()
 This method just registers this texture to be updated at the end of the current frame.
void setUpdateRect (const RectI &newRect)
 This lets you change the rect that this texture grabs from the screen This is not a cheap operation, you don't want to do it unless you have a good reason to.
void setEnableRTT (bool enable=true)
 Manually enable or disable RTT mode.
void storePixels ()
 Stores the pixels defined by the updateRect into a temporary DynamicTexture object so that they can be restored at a later time.
void restorePixels ()
 Restores the pixels in the temporary DynamicTexture object by doing a dglDrawBitmap with them and drawing them, stretched to the updateRect.
TextureHandle getTextureHandle () const
 Returns the texture handle for this so it can be used to render.
const RectF *const texCoordInfo () const
 Returns a const pointer to the texture coordinate information.
const RectI *const getUpdateRect () const
 Returns the update rect of this dynamic texture.
GuiControlgetGuiControl () const
 Returns the GuiControl this texture is using, if any.
void renderGuiControl (GuiControl *ctrl=NULL, bool rttMode=false)
 Renders a GuiControl, and it's children, to the texture This has two different behaviors depending on if RTT emulation is specified as enabled.

Static Public Member Functions

static void updateGuiTextures ()
 This method is called in GuiCanvas before the screen-rendering takes place to update all of the registered GUI update textures.
static void updateScreenTextures ()
 This method is called in GuiCanvas right before the buffers are swapped.
static void updateEndOfFrameTextures ()
 This method will update all the textures that asked to be rendered at the end of the current frame.

Private Types

typedef Vector< DynamicTexture
* >::iterator 
RegisteredUpdateItr

Private Member Functions

void initDT ()
 Helper function for the constructors.

Private Attributes

TextureHandle * mTextureHandle
 TextureHandle.
Point2I mSize
S32 mTexCBHandle
RectI mUpdateRect
 When you call update() this is the rect, in screen coordinates, that gets grabbed.
RectF mTextureCoords
 This is the texturecoord information you need to know to create texturecoords if you are not using dglDrawBitmap.
bool mRTT
 Supports RTT emulation for Gui.
bool mHasUpdateRect
 Lets this have a default constructor.
GuiControlmGuiControl
 If the object is registered as wanting a Gui update every frame, this is the variable that contains the Gui control it will render.
DynamicTexturemTempDynamicTexture
 For RTT emulation.

Static Private Attributes

static Vector< DynamicTexture * > smRegisteredGuiUpdaters
 This is a vector of DynamicTexture objects that will be updated every frame with their mGuiControl rendered to them.
static Vector< DynamicTexture * > smRegisteredScreenUpdaters
static Vector< DynamicTexture * > smUpdateAtEndOfFrame

Friends

void dynamicTextureCB (const U32 eventCode, void *userData)


Member Typedef Documentation


Constructor & Destructor Documentation

DynamicTexture::DynamicTexture (  ) 

Default Constructor.

DynamicTexture::DynamicTexture ( const RectI updateRect  ) 

Constructor.

Parameters:
updateRect The screen-rect this will grab from the color-buffer when update() is called

DynamicTexture::DynamicTexture ( GuiControl control  ) 

Gui updater Constructor.

Parameters:
control Gui control to render to this texture every frame

DynamicTexture::~DynamicTexture (  ) 

Destructor.


Member Function Documentation

void DynamicTexture::initDT (  )  [inline, private]

Helper function for the constructors.

void DynamicTexture::update (  ) 

Grabs the rectangle defined by mUpdateRect from the color-buffer and sticks it in the texture.

void DynamicTexture::setUpdateRect ( const RectI newRect  ) 

This lets you change the rect that this texture grabs from the screen This is not a cheap operation, you don't want to do it unless you have a good reason to.

Parameters:
newUpdatePoint The new rect, in screen coordinates, to use for the update rect

TextureHandle DynamicTexture::getTextureHandle (  )  const [inline]

Returns the texture handle for this so it can be used to render.

Returns:
Texture handle for the dynamic texture

const RectF *const DynamicTexture::texCoordInfo (  )  const [inline]

Returns a const pointer to the texture coordinate information.

Returns:
Texture coordinate information

const RectI *const DynamicTexture::getUpdateRect (  )  const [inline]

Returns the update rect of this dynamic texture.

Returns:
Update rect for the dynamic texture

GuiControl * DynamicTexture::getGuiControl (  )  const [inline]

Returns the GuiControl this texture is using, if any.

void DynamicTexture::renderGuiControl ( GuiControl ctrl = NULL,
bool  rttMode = false 
)

Renders a GuiControl, and it's children, to the texture This has two different behaviors depending on if RTT emulation is specified as enabled.

In OpenGL, rendering to an off screen buffer is a platform-specific operation and I don't have a Mac to make sure this works and what have you, so what happens is, if RTT mode is turned on, the area that will be used to draw the texture will be saved, with the temp DyanmicTexture object then the rendering will take place, it will grab the texture, then restore the edited area of the color-buffer.

If RTT is turned off, then it will draw the control on the screen, grab it, and leave it. This is not as useless as it seems, this is not at all a bad way to do things, just do it all in the GuiCanvas before it begins rendering the content control

See also:
GuiCanvas::renderFrame
Parameters:
ctrl GuiControl to render


Friends And Related Function Documentation

void dynamicTextureCB ( const U32  eventCode,
void userData 
) [friend]


Field Documentation

TextureHandle* DynamicTexture::mTextureHandle [private]

TextureHandle.

When you call update() this is the rect, in screen coordinates, that gets grabbed.

This is the texturecoord information you need to know to create texturecoords if you are not using dglDrawBitmap.

bool DynamicTexture::mRTT [private]

Supports RTT emulation for Gui.

See also:
renderGuiControl

Lets this have a default constructor.

If the object is registered as wanting a Gui update every frame, this is the variable that contains the Gui control it will render.

For RTT emulation.

This is a vector of DynamicTexture objects that will be updated every frame with their mGuiControl rendered to them.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen