BALL::VIEW::BufferedRenderer Class Reference

Interface for Buffered Rendering. More...

#include <bufferedRenderer.h>

Inheritance diagram for BALL::VIEW::BufferedRenderer:
Inheritance graph
[legend]

List of all members.


Public Member Functions

bool setFrameBufferFormat (const FrameBufferFormat &format)
Tries to choose a format for buffered rendering.
void renderToBuffer (RenderTarget *renderTarget, const Stage &stage) throw (BALL::Exception::InvalidFormat, BALL::Exception::NoBufferAvailable)
Render the current frame to the target's buffer using the Stage setup.
virtual bool supports (const PixelFormat &format) const =0
Checks if a particular PixelFormat is supported by the renderer.
virtual Resolution getSupportedResolution (const Resolution &min, const Resolution &max, const PixelFormat &format) const =0 throw (BALL::Exception::FormatUnsupported)
Returns a supported resolution within the given limits.

Protected Member Functions

virtual bool supports (const FrameBufferFormat &format) const =0
Checks if a particular FrameBufferFormat is supported by the renderer.
virtual void formatUpdated ()=0
This is called once the FrameBufferFormat has been set so the renderer can perform any initialization steps that are needed.
virtual void prepareBufferedRendering (const Stage &stage)=0
Prepare for the rendering, taking into account settings in Stage, eg.
virtual void renderToBufferImpl (FrameBufferPtr buffer)=0
Render to the frame buffer.
const FrameBufferFormat & getFrameBufferFormat () const
Returns the current FrameBufferFormat.

Detailed Description

Interface for Buffered Rendering.

BufferedRenderers don't create their own window. Instead, they render the scene to a FrameBuffer which is provided by a RenderTarget. The FrameBuffer contains a pointer to a memory area where the results will be stored, as well as the pixel format and the resolution. Before rendering can start, you have to choose an output format using the setFrameBufferFormat() function. After that, you can call renderToBuffer(), as long as the format of the RenderTarget is the same that you set before.


Member Function Documentation

const FrameBufferFormat& BALL::VIEW::BufferedRenderer::getFrameBufferFormat ( ) const [protected]

Returns the current FrameBufferFormat.

virtual Resolution BALL::VIEW::BufferedRenderer::getSupportedResolution ( const Resolution & min,
const Resolution & max,
const PixelFormat & format
) const throw (BALL::Exception::FormatUnsupported) [pure virtual]

Returns a supported resolution within the given limits.

The x resolution will be between min.x and max.x and the y resolution will be between min.y and max.y. The returned resolution must be supported by the renderer with the requested PixelFormat.

virtual void BALL::VIEW::BufferedRenderer::prepareBufferedRendering ( const Stage & stage ) [protected, pure virtual]

Prepare for the rendering, taking into account settings in Stage, eg.

Camera, Lights, Background colors, etc.

Referenced by renderToBuffer().

void BALL::VIEW::BufferedRenderer::renderToBuffer ( RenderTarget * renderTarget,
const Stage & stage
) throw (BALL::Exception::InvalidFormat, BALL::Exception::NoBufferAvailable)

Render the current frame to the target's buffer using the Stage setup.

Throws FrameBufferFormatException if the RenderTarget's format is not the one that you set before with setFrameBufferFormat().

References prepareBufferedRendering(), and renderToBufferImpl().

virtual void BALL::VIEW::BufferedRenderer::renderToBufferImpl ( FrameBufferPtr buffer ) [protected, pure virtual]

Render to the frame buffer.

Precondition:
The frame buffer's format is the one stored in bufferFormat and prepareBufferedRendering() has been called.

Referenced by renderToBuffer().

bool BALL::VIEW::BufferedRenderer::setFrameBufferFormat ( const FrameBufferFormat & format )

Tries to choose a format for buffered rendering.

Returns:
true if the format could be set, false if it is not supported.

References formatUpdated(), and supports().

virtual bool BALL::VIEW::BufferedRenderer::supports ( const FrameBufferFormat & format ) const [protected, pure virtual]

Checks if a particular FrameBufferFormat is supported by the renderer.

This checks the combination of pixel format and resolution. If this returns true, the renderer is able to write to a buffer in this format.

virtual bool BALL::VIEW::BufferedRenderer::supports ( const PixelFormat & format ) const [pure virtual]

Checks if a particular PixelFormat is supported by the renderer.

Referenced by setFrameBufferFormat().


Generated on Thu Aug 6 18:30:59 2009 for BALL by doxygen 1.5.8