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

Ogre::RenderWindow Class Reference

Manages the target rendering window. More...

#include <OgreRenderWindow.h>

Inheritance diagram for Ogre::RenderWindow:

Ogre::RenderTarget Ogre::D3D7RenderWindow Ogre::D3D8RenderWindow Ogre::D3D9RenderWindow Ogre::SDLWindow 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

 RenderWindow ()
 Default constructor. More...

virtual void create (String name, int width, int height, int colourDepth, bool fullScreen, int left, int top, bool depthBuffer, void *miscParam,...)=0
 Creates & displays the new window. More...

virtual void destroy (void)=0
 Destroys the window. More...

virtual void resize (int width, int height)=0
 Alter the size of the window. More...

virtual void reposition (int left, int top)=0
 Reposition the window. More...

virtual bool isClosed (void)=0
 Indicates whether the window has been closed by the user. More...

virtual void swapBuffers (bool waitForVSync=true)=0
 Swaps the frame buffers to display the next frame. More...

virtual void update (void)
 Updates the window contents. More...

virtual bool isFullScreen (void)
 Returns true if window is running in fullscreen mode. More...

virtual void getMetrics (int &width, int &height, int &colourDepth, int &left, int &top)
 Overloaded version of getMetrics from RenderTarget, including extra details specific to windowing systems. 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 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

bool mIsFullScreen
int mLeft
int mTop
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

Detailed Description

Manages the target rendering window.

Remarks:
This class handles a window into which the contents of a scene are rendered. There is a many-to-1 relationship between instances of this class an instance of RenderSystem which controls the rendering of the scene. There may be more than one window in the case of level editor tools etc. This class is abstract since there may be different implementations for different windowing systems.
Instances are created and communicated with by the render system although client programs can get a reference to it from the render system if required for resizing or moving. Note that you can have multiple viewpoints in the window for effects like rear-view mirrors and picture-in-picture views (see Viewport and Camera).
Author:
Steven Streeting
Version:
1.0


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 


Constructor & Destructor Documentation

Ogre::RenderWindow::RenderWindow  
 

Default constructor.


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::RenderWindow::create String    name,
int    width,
int    height,
int    colourDepth,
bool    fullScreen,
int    left,
int    top,
bool    depthBuffer,
void *    miscParam,
...   
[pure virtual]
 

Creates & displays the new window.

Parameters:
width  The width of the window in pixels.
height  The height of the window in pixels.
colourDepth  The colour depth in bits. Ignored if fullScreen is false since the desktop depth is used.
fullScreen  If true, the window fills the screen, with no title bar or border.
left  The x-position of the window. Ignored if fullScreen = true.
top  The y-position of the window. Ignored if fullScreen = true.
depthBuffer  Specify true to include a depth-buffer.
miscParam  A variable number of pointers to platform-specific arguments. The actual requirements must be defined by the implementing subclasses.

Implemented in Ogre::D3D7RenderWindow.

virtual void Ogre::RenderWindow::destroy void    [pure virtual]
 

Destroys the window.

Implemented in Ogre::D3D7RenderWindow.

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.

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

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.

void Ogre::RenderWindow::getMetrics int &    width,
int &    height,
int &    colourDepth,
int &    left,
int &    top
[virtual]
 

Overloaded version of getMetrics from RenderTarget, including extra details specific to windowing systems.

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

Retrieve target's name.

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.

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.

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]
 

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

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

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

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

Reimplemented in Ogre::D3D7RenderWindow.

virtual bool Ogre::RenderWindow::isClosed void    [pure virtual]
 

Indicates whether the window has been closed by the user.

Implemented in Ogre::D3D7RenderWindow.

bool Ogre::RenderWindow::isFullScreen void    [virtual]
 

Returns true if window is running in fullscreen mode.

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 void Ogre::RenderWindow::reposition int    left,
int    top
[pure virtual]
 

Reposition the window.

Implemented in Ogre::D3D7RenderWindow.

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.

virtual void Ogre::RenderWindow::resize int    width,
int    height
[pure virtual]
 

Alter the size of the window.

Implemented in Ogre::D3D7RenderWindow.

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.

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

virtual void Ogre::RenderWindow::swapBuffers bool    waitForVSync = true [pure virtual]
 

Swaps the frame buffers to display the next frame.

Remarks:
All render windows are double-buffered so that no 'in-progress' versions of the scene are displayed during rendering. Once rendering has completed (to an off-screen version of the window) the buffers are swapped to display the new frame.
Parameters:
waitForVSync  If true, the system waits for the next vertical blank period (when the CRT beam turns off as it travels from bottom-right to top-left at the end of the pass) before flipping. If false, flipping occurs no matter what the beam position. Waiting for a vertical blank can be slower (and limits the framerate to the monitor refresh rate) but results in a steadier image with no 'tearing' (a flicker resulting from flipping buffers when the beam is in the progress of drawing the last frame).

Implemented in Ogre::D3D7RenderWindow.

void Ogre::RenderWindow::update void    [virtual]
 

Updates the window contents.

Remarks:
The window is updated by telling each camera which is supposed to render into this window to render it's view, and then the window buffers are swapped via swapBuffers()

Reimplemented from Ogre::RenderTarget.

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]
 

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

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

bool Ogre::RenderWindow::mIsFullScreen [protected]
 

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

int Ogre::RenderWindow::mLeft [protected]
 

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

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

The name of this target.

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

The priority of the render target.

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

int Ogre::RenderWindow::mTop [protected]
 

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

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

List of viewports, map on Z-order.

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

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

Copyright © 2002 by The OGRE Team