Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::RenderTargetTexture Class Reference

#include <OgreRenderTargetTexture.h>

Inheritance diagram for Ogre::RenderTargetTexture:

Ogre::Texture Ogre::RenderTarget Ogre::Resource List of all members.

Public Types

enum  StatFlags {
  SF_NONE = 0, SF_FPS = 1, SF_AVG_FPS = 2, SF_BEST_FPS = 4,
  SF_WORST_FPS = 8, SF_TRIANGLE_COUNT = 16, SF_ALL = 0xFFFF
}

Public Methods

virtual bool isRenderTarget ()
 @copydoc Texture::isRenderTarget. More...

unsigned short getNumMipMaps (void)
 Gets the number of mipmaps to be used for this texture. More...

void setNumMipMaps (unsigned short num)
 Sets the number of mipmaps to be used for this texture. More...

float getGamma (void)
 Returns the gamma adjustment factor applied to this texture. More...

void setGamma (float g)
 Sets the gamma adjustment factor applied to this texture. More...

unsigned int getHeight (void)
 Returns the height of the texture. More...

unsigned int getWidth (void)
 Returns the width of the texture. More...

std::pair< uint, uintgetDimensions ()
 Returns both the width and height of the texture. More...

TextureUsage getUsage () const
virtual void blitToTexture (const Image &src, unsigned uStartX, unsigned uStartY)=0
 Blits the contents of src on the texture. More...

virtual void blitImage (const Image &src, const Image::Rect imgRect, const Image::Rect texRect)
 Blits a rect from an image to the texture. More...

virtual void copyToTexture (Texture *target)
 Copies (and maybe scales to fit) the contents of this texture to another texture. More...

virtual void loadImage (const Image &img)=0
 Loads the data from an image. More...

void enable32Bit (bool setting=true)
virtual PixelFormat getFormat () const
 Returns the pixel format for the texture surface. More...

virtual bool hasAlpha (void)
 Returns true if the texture has an alpha layer. More...

virtual void load ()=0
 Loads the resource, if it is not already. More...

virtual void unload ()
 Unloads the resource, but retains data to recreate. More...

virtual size_t getSize (void)
 Retrieves info about the size of the resource. More...

void touch (void)
 'Touches' the resource to indicate it has been used. More...

time_t getLastAccess (void) const
 Gets the last time the resource was 'touched'. More...

const StringgetName (void) const
 Gets resource name. More...

bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise. More...

virtual void destroy ()
 A method to make the resource delete itself. More...

virtual String getName (void)
 Retrieve target's name. More...

virtual void getMetrics (int &width, int &height, int &colourDepth)
 Retrieve information about the render target. More...

virtual int getWidth (void)
virtual int getHeight (void)
virtual int getColourDepth (void)
virtual void update (void)
 Tells the target to update it's contents. More...

virtual ViewportaddViewport (Camera *cam, int ZOrder=0, float left=0, float top=0, float width=100, float height=100)
 Adds a viewport to the rendering target. More...

virtual unsigned short getNumViewports (void)
 Returns the number of viewports attached to this target. More...

virtual ViewportgetViewport (unsigned short index)
 Retrieves a pointer to the viewport with the given index. More...

virtual void removeViewport (int ZOrder)
 Removes a viewport at a given ZOrder. More...

virtual void removeAllViewports (void)
 Removes all viewports on this target. More...

virtual void setStatsDisplay (StatFlags sf)
 DEPRECATED Set what kind of statistics display (if any) should be displayed by the system about this target. More...

virtual void getStatistics (float &lastFPS, float &avgFPS, float &bestFPS, float &worstFPS)
 Retieves details of current rendering performance. More...

virtual float getLastFPS ()
 Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered. More...

virtual float getAverageFPS ()
 Individual stats access - gets the average frames per second (FPS) since call to RenderSystem::startRendering. More...

virtual float getBestFPS ()
 Individual stats access - gets the best frames per second (FPS) since call to RenderSystem::startRendering. More...

virtual float getWorstFPS ()
 Individual stats access - gets the worst frames per second (FPS) since call to RenderSystem::startRendering. More...

virtual void resetStatistics (void)
 Resets saved frame-rate statistices. More...

virtual void outputText (int x, int y, const String &text)=0
 DEPRECATED Outputs text to the target at the specified co-ordinates. More...

virtual void getCustomAttribute (String name, void *pData)
 Gets a custom (maybe platform-specific) attribute. More...

virtual void setDebugText (const String &text)
 Adds debug text to this window. More...

const StringRenderTarget::getDebugText () const
 Returns the debug text. More...

virtual void addListener (RenderTargetListener *listener)
 Add a listener to this RenderTarget which will be called back before & after rendering. More...

virtual void removeListener (RenderTargetListener *listener)
 Removes a RenderTargetListener previously registered using addListener. More...

virtual void removeAllListeners (void)
 Removes all listeners from this instance. More...

virtual void setPriority (uchar priority)
 Sets the priority of this render target in relation to the others. More...

virtual uchar getPriority () const
 Gets the priority of a render target. More...

virtual bool isActive () const
 Used to retrieve or set the active state of the render target. More...

virtual void setActive (bool state)
 Used to retrieve the active state of the render target. More...

virtual void writeContentsToFile (const String &filename)=0
 Writes the current contents of the render target to the named file. More...

virtual bool requiresTextureFlipping () const=0

Protected Types

typedef std::map< int, Viewport *,
std::less< int > > 
ViewportList
typedef std::vector< RenderTargetListener * > RenderTargetListenerList

Protected Methods

void updateStats (void)
virtual void firePreUpdate (void)
 internal method for firing events. More...

virtual void firePostUpdate (void)
 internal method for firing events. More...


Protected Attributes

unsigned long mHeight
unsigned long mWidth
unsigned short mNumMipMaps
float mGamma
PixelFormat mFormat
TextureUsage mUsage
unsigned short mSrcBpp
unsigned long mSrcWidth
unsigned long mSrcHeight
unsigned short mFinalBpp
bool mHasAlpha
String mName
bool mIsLoaded
time_t mLastAccess
size_t mSize
String mName
 The name of this target. More...

uchar mPriority
 The priority of the render target. More...

int mWidth
int mHeight
int mColourDepth
bool mIsDepthBuffered
StatFlags mStatFlags
float mLastFPS
float mAvgFPS
float mBestFPS
float mWorstFPS
unsigned int mTris
String mDebugText
bool mActive
ViewportList mViewportList
 List of viewports, map on Z-order. More...

RenderTargetListenerList mListeners

Member Typedef Documentation

typedef std::vector<RenderTargetListener*> Ogre::RenderTarget::RenderTargetListenerList [protected, inherited]
 

typedef std::map<int, Viewport*, std::less<int> > Ogre::RenderTarget::ViewportList [protected, inherited]
 


Member Enumeration Documentation

enum Ogre::RenderTarget::StatFlags [inherited]
 

Enumeration values:
SF_NONE 
SF_FPS 
SF_AVG_FPS 
SF_BEST_FPS 
SF_WORST_FPS 
SF_TRIANGLE_COUNT 
SF_ALL 


Member Function Documentation

void Ogre::RenderTarget::addListener RenderTargetListener   listener [virtual, inherited]
 

Add a listener to this RenderTarget which will be called back before & after rendering.

Remarks:
If you want notifications before and after a target is updated by the system, use this method to register your own custom RenderTargetListener class. This is useful for potentially adding your own manual rendering commands before and after the 'normal' system rendering.
NB this should not be used for frame-based scene updates, use Root::addFrameListener for that.

Viewport * Ogre::RenderTarget::addViewport Camera   cam,
int    ZOrder = 0,
float    left = 0,
float    top = 0,
float    width = 100,
float    height = 100
[virtual, inherited]
 

Adds a viewport to the rendering target.

Remarks:
A viewport is the rectangle into which redering output is sent. This method adds a viewport to the render target, rendering from the supplied camera. The rest of the parameters are only required if you wish to add more than one viewport to a single rendering target. Note that size information passed to this method is passed as a percentage, i.e. it is relative rather than absolute. This is to allow viewports to automatically resize along with the target.
Parameters:
cam  The camera from which the viewport contents will be rendered (mandatory)
ZOrder  The relative order of the viewport with others on the target (allows overlapping viewports i.e. picture-in-picture). Higher ZOrders are on top of lower ones. The actual number is irrelevant, only the relative ZOrder matters (you can leave gaps in the numbering)
left  The relative position of the left of the viewport on the target, as a percentage.
top  The relative position of the top of the viewport on the target, as a percentage.
width  The relative width of the viewport on the target, as a percentage.
height  The relative height of the viewport on the target, as a percentage.

virtual void Ogre::Texture::blitImage const Image   src,
const Image::Rect    imgRect,
const Image::Rect    texRect
[inline, virtual, inherited]
 

Blits a rect from an image to the texture.

Parameters:
src  The image with the source data.
imgRect  The data rect to be copied from the image.
texRect  The rect in which to copy the data in the texture.

Reimplemented in Ogre::D3DTexture.

virtual void Ogre::Texture::blitToTexture const Image   src,
unsigned    uStartX,
unsigned    uStartY
[pure virtual, inherited]
 

Blits the contents of src on the texture.

Deprecated:
This feature is superseded by the blitImage function.
Parameters:
src  the image with the source data

Implemented in Ogre::D3DTexture.

virtual void Ogre::Texture::copyToTexture Texture   target [inline, virtual, inherited]
 

Copies (and maybe scales to fit) the contents of this texture to another texture.

Reimplemented in Ogre::D3DTexture.

virtual void Ogre::Resource::destroy void    [inline, virtual, inherited]
 

A method to make the resource delete itself.

Note:
This exists because Resource objects could be created in other processes, and they need to be destroyed in the process that created them.

void Ogre::Texture::enable32Bit bool    setting = true [inline, inherited]
 

void Ogre::RenderTarget::firePostUpdate void    [protected, virtual, inherited]
 

internal method for firing events.

Reimplemented in Ogre::RenderTexture.

void Ogre::RenderTarget::firePreUpdate void    [protected, virtual, inherited]
 

internal method for firing events.

float Ogre::RenderTarget::getAverageFPS   [virtual, inherited]
 

Individual stats access - gets the average frames per second (FPS) since call to RenderSystem::startRendering.

float Ogre::RenderTarget::getBestFPS   [virtual, inherited]
 

Individual stats access - gets the best frames per second (FPS) since call to RenderSystem::startRendering.

int Ogre::RenderTarget::getColourDepth void    [virtual, inherited]
 

void Ogre::RenderTarget::getCustomAttribute String    name,
void *    pData
[virtual, inherited]
 

Gets a custom (maybe platform-specific) attribute.

Remarks:
This is a nasty way of satisfying any API's need to see platform-specific details. It horrid, but D3D needs this kind of info. At least it's abstracted.
Parameters:
name  The name of the attribute.
pData  Pointer to memory of the right kind of structure to receive the info.

Reimplemented in Ogre::D3D7RenderWindow.

std::pair< uint, uint > Ogre::Texture::getDimensions   [inline, inherited]
 

Returns both the width and height of the texture.

virtual PixelFormat Ogre::Texture::getFormat   const [inline, virtual, inherited]
 

Returns the pixel format for the texture surface.

float Ogre::Texture::getGamma void    [inline, inherited]
 

Returns the gamma adjustment factor applied to this texture.

int Ogre::RenderTarget::getHeight void    [virtual, inherited]
 

unsigned int Ogre::Texture::getHeight void    [inline, inherited]
 

Returns the height of the texture.

time_t Ogre::Resource::getLastAccess void    const [inline, inherited]
 

Gets the last time the resource was 'touched'.

float Ogre::RenderTarget::getLastFPS   [virtual, inherited]
 

Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.

void Ogre::RenderTarget::getMetrics int &    width,
int &    height,
int &    colourDepth
[virtual, inherited]
 

Retrieve information about the render target.

String Ogre::RenderTarget::getName void    [virtual, inherited]
 

Retrieve target's name.

const String& Ogre::Resource::getName void    const [inline, inherited]
 

Gets resource name.

Reimplemented in Ogre::Material.

unsigned short Ogre::Texture::getNumMipMaps void    [inline, inherited]
 

Gets the number of mipmaps to be used for this texture.

unsigned short Ogre::RenderTarget::getNumViewports void    [virtual, inherited]
 

Returns the number of viewports attached to this target.

virtual uchar Ogre::RenderTarget::getPriority   const [inline, virtual, inherited]
 

Gets the priority of a render target.

virtual size_t Ogre::Resource::getSize void    [inline, virtual, inherited]
 

Retrieves info about the size of the resource.

void Ogre::RenderTarget::getStatistics float &    lastFPS,
float &    avgFPS,
float &    bestFPS,
float &    worstFPS
[virtual, inherited]
 

Retieves details of current rendering performance.

Remarks:
If the user application wishes to do it's own performance display, or use performance for some other means, this method allows it to retrieve the statistics.
Parameters:
lastFPS  Pointer to a float to receive the number of frames per second (FPS) based on the last frame rendered.
avgFPS  Pointer to a float to receive the FPS rating based on an average of all the frames rendered since rendering began (the call to RenderSystem::startRendering).
bestFPS  Pointer to a float to receive the best FPS rating that has been achieved since rendering began.
worstFPS  Pointer to a float to receive the worst FPS rating seen so far.

TextureUsage Ogre::Texture::getUsage   const [inline, inherited]
 

Viewport * Ogre::RenderTarget::getViewport unsigned short    index [virtual, inherited]
 

Retrieves a pointer to the viewport with the given index.

int Ogre::RenderTarget::getWidth void    [virtual, inherited]
 

unsigned int Ogre::Texture::getWidth void    [inline, inherited]
 

Returns the width of the texture.

float Ogre::RenderTarget::getWorstFPS   [virtual, inherited]
 

Individual stats access - gets the worst frames per second (FPS) since call to RenderSystem::startRendering.

virtual bool Ogre::Texture::hasAlpha void    [inline, virtual, inherited]
 

Returns true if the texture has an alpha layer.

bool Ogre::RenderTarget::isActive   const [virtual, inherited]
 

Used to retrieve or set the active state of the render target.

Reimplemented in Ogre::D3D7RenderWindow.

bool Ogre::Resource::isLoaded void    const [inline, inherited]
 

Returns true if the Resource has been loaded, false otherwise.

virtual bool Ogre::RenderTargetTexture::isRenderTarget   [inline, virtual]
 

@copydoc Texture::isRenderTarget.

virtual void Ogre::Resource::load   [pure virtual, inherited]
 

Loads the resource, if it is not already.

Implemented in Ogre::ArchiveEx.

virtual void Ogre::Texture::loadImage const Image   img [pure virtual, inherited]
 

Loads the data from an image.

Implemented in Ogre::D3DTexture.

virtual void Ogre::RenderTarget::outputText int    x,
int    y,
const String   text
[pure virtual, inherited]
 

DEPRECATED Outputs text to the target at the specified co-ordinates.

Implemented in Ogre::D3D7RenderWindow.

void Ogre::RenderTarget::removeAllListeners void    [virtual, inherited]
 

Removes all listeners from this instance.

void Ogre::RenderTarget::removeAllViewports void    [virtual, inherited]
 

Removes all viewports on this target.

void Ogre::RenderTarget::removeListener RenderTargetListener   listener [virtual, inherited]
 

Removes a RenderTargetListener previously registered using addListener.

void Ogre::RenderTarget::removeViewport int    ZOrder [virtual, inherited]
 

Removes a viewport at a given ZOrder.

const String& Ogre::RenderTarget::RenderTarget::getDebugText   const [inherited]
 

Returns the debug text.

virtual bool Ogre::RenderTarget::requiresTextureFlipping   const [pure virtual, inherited]
 

Implemented in Ogre::D3D7RenderWindow.

void Ogre::RenderTarget::resetStatistics void    [virtual, inherited]
 

Resets saved frame-rate statistices.

void Ogre::RenderTarget::setActive bool    state [virtual, inherited]
 

Used to retrieve the active state of the render target.

Reimplemented in Ogre::D3D9RenderWindow.

void Ogre::RenderTarget::setDebugText const String   text [virtual, inherited]
 

Adds debug text to this window.

void Ogre::Texture::setGamma float    g [inline, inherited]
 

Sets the gamma adjustment factor applied to this texture.

Note:
Must be called before any 'load' method.

void Ogre::Texture::setNumMipMaps unsigned short    num [inline, inherited]
 

Sets the number of mipmaps to be used for this texture.

Note:
Must be set before calling any 'load' method.

virtual void Ogre::RenderTarget::setPriority uchar    priority [inline, virtual, inherited]
 

Sets the priority of this render target in relation to the others.

Remarks:
This can be used in order to schedule render target updates. Lower priorities will be rendered first. Note that the priority must be set at the time the render target is attached to the render system, changes afterwards will not affect the ordering.

void Ogre::RenderTarget::setStatsDisplay StatFlags    sf [virtual, inherited]
 

DEPRECATED Set what kind of statistics display (if any) should be displayed by the system about this target.

Remarks:
This method is now DEPRECATED. Use Root::showDebugOverlay instead. OGRE keeps details about the current rendering performance, and can display this on screen if required. This method allows you to specify what should be displayed. Alternatively, the application can retrieve the stats using RenderTarget::getStatistics and report them itself.
Parameters:
sf  Flags indicating which stats to display. Details are in StatFlags

void Ogre::Resource::touch void    [inline, inherited]
 

'Touches' the resource to indicate it has been used.

virtual void Ogre::Resource::unload void    [inline, virtual, inherited]
 

Unloads the resource, but retains data to recreate.

Reimplemented in Ogre::ArchiveEx.

void Ogre::RenderTarget::update void    [virtual, inherited]
 

Tells the target to update it's contents.

Remarks:
If OGRE is not running in an automatic rendering loop (started using RenderSystem::startRendering), the user of the library is responsible for asking each render target to refresh. This is the method used to do this. It automatically re-renders the contents of the target using whatever cameras have been pointed at it (using Camera::setRenderTarget).

This allows OGRE to be used in multi-windowed utilities and for contents to be refreshed only when required, rather than constantly as with the automatic rendering loop.

Reimplemented in Ogre::RenderWindow.

void Ogre::RenderTarget::updateStats void    [protected, inherited]
 

virtual void Ogre::RenderTarget::writeContentsToFile const String   filename [pure virtual, inherited]
 

Writes the current contents of the render target to the named file.

Implemented in Ogre::D3D7RenderWindow.


Member Data Documentation

bool Ogre::RenderTarget::mActive [protected, inherited]
 

Reimplemented in Ogre::D3D7RenderWindow.

float Ogre::RenderTarget::mAvgFPS [protected, inherited]
 

float Ogre::RenderTarget::mBestFPS [protected, inherited]
 

int Ogre::RenderTarget::mColourDepth [protected, inherited]
 

String Ogre::RenderTarget::mDebugText [protected, inherited]
 

unsigned short Ogre::Texture::mFinalBpp [protected, inherited]
 

PixelFormat Ogre::Texture::mFormat [protected, inherited]
 

float Ogre::Texture::mGamma [protected, inherited]
 

bool Ogre::Texture::mHasAlpha [protected, inherited]
 

int Ogre::RenderTarget::mHeight [protected, inherited]
 

unsigned long Ogre::Texture::mHeight [protected, inherited]
 

bool Ogre::RenderTarget::mIsDepthBuffered [protected, inherited]
 

bool Ogre::Resource::mIsLoaded [protected, inherited]
 

time_t Ogre::Resource::mLastAccess [protected, inherited]
 

float Ogre::RenderTarget::mLastFPS [protected, inherited]
 

RenderTargetListenerList Ogre::RenderTarget::mListeners [protected, inherited]
 

String Ogre::RenderTarget::mName [protected, inherited]
 

The name of this target.

String Ogre::Resource::mName [protected, inherited]
 

unsigned short Ogre::Texture::mNumMipMaps [protected, inherited]
 

uchar Ogre::RenderTarget::mPriority [protected, inherited]
 

The priority of the render target.

size_t Ogre::Resource::mSize [protected, inherited]
 

unsigned short Ogre::Texture::mSrcBpp [protected, inherited]
 

unsigned long Ogre::Texture::mSrcHeight [protected, inherited]
 

unsigned long Ogre::Texture::mSrcWidth [protected, inherited]
 

StatFlags Ogre::RenderTarget::mStatFlags [protected, inherited]
 

unsigned int Ogre::RenderTarget::mTris [protected, inherited]
 

TextureUsage Ogre::Texture::mUsage [protected, inherited]
 

ViewportList Ogre::RenderTarget::mViewportList [protected, inherited]
 

List of viewports, map on Z-order.

int Ogre::RenderTarget::mWidth [protected, inherited]
 

unsigned long Ogre::Texture::mWidth [protected, inherited]
 

float Ogre::RenderTarget::mWorstFPS [protected, inherited]
 

Copyright © 2002 by The OGRE Team