#include <BALL/VIEW/RENDERING/bufferedRenderer.h>
Public Member Functions | |
BufferedRenderer () | |
virtual | ~BufferedRenderer () throw () |
bool | setFrameBufferFormat (const FrameBufferFormat &format) |
void | renderToBuffer (RenderTarget *renderTarget, const Stage &stage) throw (BALL::Exception::InvalidFormat, BALL::Exception::NoBufferAvailable) |
virtual bool | supports (const PixelFormat &format) const =0 |
virtual Resolution | getSupportedResolution (const Resolution &min, const Resolution &max, const PixelFormat &format) const =0 throw (BALL::Exception::FormatUnsupported) |
Protected Member Functions | |
virtual bool | supports (const FrameBufferFormat &format) const =0 |
virtual void | formatUpdated ()=0 |
virtual void | prepareBufferedRendering (const Stage &stage)=0 |
virtual void | renderToBufferImpl (FrameBufferPtr buffer)=0 |
const FrameBufferFormat & | getFrameBufferFormat () const |
Private Attributes | |
FrameBufferFormat | bufferFormat |
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.
BALL::VIEW::BufferedRenderer::BufferedRenderer | ( | ) | [inline] |
virtual BALL::VIEW::BufferedRenderer::~BufferedRenderer | ( | ) | throw () [inline, virtual] |
virtual void BALL::VIEW::BufferedRenderer::formatUpdated | ( | ) | [protected, pure virtual] |
This is called once the FrameBufferFormat has been set so the renderer can perform any initialization steps that are needed.
Referenced by setFrameBufferFormat().
const FrameBufferFormat& BALL::VIEW::BufferedRenderer::getFrameBufferFormat | ( | ) | const [inline, protected] |
Returns the current FrameBufferFormat.
References bufferFormat.
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) [inline] |
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 bufferFormat, prepareBufferedRendering(), and renderToBufferImpl().
virtual void BALL::VIEW::BufferedRenderer::renderToBufferImpl | ( | FrameBufferPtr | buffer | ) | [protected, pure virtual] |
Render to the frame buffer.
Referenced by renderToBuffer().
bool BALL::VIEW::BufferedRenderer::setFrameBufferFormat | ( | const FrameBufferFormat & | format | ) | [inline] |
Tries to choose a format for buffered rendering.
References bufferFormat, 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().
Referenced by getFrameBufferFormat(), renderToBuffer(), and setFrameBufferFormat().