Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Attributes | List of all members
om::graphics::devices::GraphicsContextRenderer Class Reference

A class that facilitates creation of a graphics rendering context that renders to one or more gui::RenderView. More...

#include <omGraphicsContextRenderer.h>

Classes

class  Delegate
 A class that contains function objects that recieve context renderer events. More...
 

Public Member Functions

 GraphicsContextRenderer ()
 Create a default graphics context renderer. More...
 
 ~GraphicsContextRenderer ()
 Destroy this context renderer, releasing all non-shared resources. More...
 
Size getViewCount () const
 Return the number of target render views that this context renderer has. More...
 
RenderView * getView (Index viewIndex) const
 Return a pointer to the target render view at the specified index. More...
 
const DelegategetViewDelegate (Index viewIndex) const
 Return a const reference to the delegate for the target render view at the specified index. More...
 
void setViewDelegate (Index viewIndex, const Delegate &newDelegate)
 Set the delegate for the target render view at the specified index. More...
 
Bool addView (RenderView *newView)
 Add a new target view that this context renderer should draw to. More...
 
Bool addView (RenderView *newView, const Delegate &delegate)
 Add a new target view and associated delegate that this context renderer should draw to. More...
 
Bool removeView (RenderView *view)
 Remove a target view that this context renderer should no longer draw to. More...
 
void clearViews ()
 Remove all target render views from this context renderer. More...
 
Bool startDrawing (const GraphicsDeviceType &deviceType, const RenderedPixelFormat &pixelFormat, const GraphicsContextFlags &flags)
 Start a background rendering thread for the context renderer that creates a context with the given attributes. More...
 
void stopDrawing ()
 A method called when the user want to stop the rendering thread for this view. More...
 
Bool isDrawing () const
 Return whether or not the context renderer is currently drawing. More...
 
const Shared< GraphicsDevice > & getDevice () const
 Return a pointer to the graphics device that is being used to render this view. More...
 
const Shared< GraphicsContext > & getContext () const
 Return a pointer to the graphics context that is being used to render this view. More...
 
const TimegetMinFrameTime () const
 Return the minimum time that can elapse between successive frames, acting as a framerate limiter. More...
 
void setMinFrameTime (const Time &newMinFrameTime)
 Set the minimum time that can elapse between successive frames, acting as a framerate limiter. More...
 
Float getMaxFrameRate () const
 Return the maximum frame rate at which this render view will be drawn. More...
 
void setMaxFrameRate (Float newMaxFrameRate)
 Return the maximum frame rate at which this render view will be drawn. More...
 
DelegategetDelegate ()
 Return an object that handles events for this context renderer. More...
 
const DelegategetDelegate () const
 Return an object that handles events for this context renderer. More...
 
void setDelegate (const Delegate &newDelegate)
 Set an object that handles events for this context renderer. More...
 

Static Public Attributes

static const Time DEFAULT_MIN_FRAME_TIME
 The default minimum frame time that is used for this context renderer. More...
 

Detailed Description

A class that facilitates creation of a graphics rendering context that renders to one or more gui::RenderView.

Constructor & Destructor Documentation

om::graphics::devices::GraphicsContextRenderer::GraphicsContextRenderer ( )

Create a default graphics context renderer.

om::graphics::devices::GraphicsContextRenderer::~GraphicsContextRenderer ( )

Destroy this context renderer, releasing all non-shared resources.

This destructor automatically stops the drawing thread and releases the graphics context for the views.

Member Function Documentation

Size om::graphics::devices::GraphicsContextRenderer::getViewCount ( ) const
inline

Return the number of target render views that this context renderer has.

RenderView* om::graphics::devices::GraphicsContextRenderer::getView ( Index  viewIndex) const
inline

Return a pointer to the target render view at the specified index.

const Delegate& om::graphics::devices::GraphicsContextRenderer::getViewDelegate ( Index  viewIndex) const
inline

Return a const reference to the delegate for the target render view at the specified index.

void om::graphics::devices::GraphicsContextRenderer::setViewDelegate ( Index  viewIndex,
const Delegate newDelegate 
)
inline

Set the delegate for the target render view at the specified index.

Bool om::graphics::devices::GraphicsContextRenderer::addView ( RenderView *  newView)

Add a new target view that this context renderer should draw to.

The method returns whether or not the view was able to be added.

Bool om::graphics::devices::GraphicsContextRenderer::addView ( RenderView *  newView,
const Delegate delegate 
)

Add a new target view and associated delegate that this context renderer should draw to.

The method returns whether or not the view was able to be added.

Bool om::graphics::devices::GraphicsContextRenderer::removeView ( RenderView *  view)

Remove a target view that this context renderer should no longer draw to.

The method returns whether or not the view was able to be removed.

void om::graphics::devices::GraphicsContextRenderer::clearViews ( )

Remove all target render views from this context renderer.

Bool om::graphics::devices::GraphicsContextRenderer::startDrawing ( const GraphicsDeviceType deviceType,
const RenderedPixelFormat pixelFormat,
const GraphicsContextFlags flags 
)

Start a background rendering thread for the context renderer that creates a context with the given attributes.

The user provides an output pixel format, and configuration flags for the new graphics context.

The method returns whether or not drawing was able to be started successfully. The method may fail if there are no suitable graphics devices, the graphics context was unable to created, or if some other error occurred.

void om::graphics::devices::GraphicsContextRenderer::stopDrawing ( )

A method called when the user want to stop the rendering thread for this view.

Bool om::graphics::devices::GraphicsContextRenderer::isDrawing ( ) const

Return whether or not the context renderer is currently drawing.

const Shared<GraphicsDevice>& om::graphics::devices::GraphicsContextRenderer::getDevice ( ) const
inline

Return a pointer to the graphics device that is being used to render this view.

If the method returns a NULL pointer, either the drawing thread is not running, or device creation failed.

const Shared<GraphicsContext>& om::graphics::devices::GraphicsContextRenderer::getContext ( ) const
inline

Return a pointer to the graphics context that is being used to render this view.

If the method returns a NULL pointer, either the drawing thread is not running, or context creation failed. Using the context from any other thread than the drawing thread will result in undefined behavior.

const Time& om::graphics::devices::GraphicsContextRenderer::getMinFrameTime ( ) const
inline

Return the minimum time that can elapse between successive frames, acting as a framerate limiter.

This is used to save CPU and GPU time when rendering interfaces that don't need to be updated as fast as the system can.

The default minimum frame time is 1/60th of a second, equivalent to a maximum frame rate of 60fps.

void om::graphics::devices::GraphicsContextRenderer::setMinFrameTime ( const Time newMinFrameTime)
inline

Set the minimum time that can elapse between successive frames, acting as a framerate limiter.

This is used to save CPU and GPU time when rendering interfaces that don't need to be updated as fast as the system can.

The default minimum frame time is 1/60th of a second, equivalent to a maximum frame rate of 60fps.

Float om::graphics::devices::GraphicsContextRenderer::getMaxFrameRate ( ) const
inline

Return the maximum frame rate at which this render view will be drawn.

This is used to save CPU and GPU time when rendering interfaces that don't need to be updated as fast as the system can.

The default maximum frame rate is 60fps.

void om::graphics::devices::GraphicsContextRenderer::setMaxFrameRate ( Float  newMaxFrameRate)
inline

Return the maximum frame rate at which this render view will be drawn.

This is used to save CPU and GPU time when rendering interfaces that don't need to be updated as fast as the system can.

If the specified maximum frame rate is less than or equal to zero, the maximum frame rate is set to infinity.

The default maximum frame rate is 60fps.

Delegate& om::graphics::devices::GraphicsContextRenderer::getDelegate ( )
inline

Return an object that handles events for this context renderer.

const Delegate& om::graphics::devices::GraphicsContextRenderer::getDelegate ( ) const
inline

Return an object that handles events for this context renderer.

void om::graphics::devices::GraphicsContextRenderer::setDelegate ( const Delegate newDelegate)
inline

Set an object that handles events for this context renderer.

Member Data Documentation

const Time om::graphics::devices::GraphicsContextRenderer::DEFAULT_MIN_FRAME_TIME
static

The default minimum frame time that is used for this context renderer.


The documentation for this class was generated from the following file: