BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
VIEW
RENDERING
bufferedRenderer.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_VIEW_RENDERING_BUFFEREDRENDERER_H
6
#define BALL_VIEW_RENDERING_BUFFEREDRENDERER_H
7
8
#ifndef BALL_VIEW_RENDERING_RENDERER_H
9
# include <
BALL/VIEW/RENDERING/renderer.h
>
10
#endif
11
12
#ifndef BALL_VIEW_RENDERING_RENDERTARGET_H
13
# include <
BALL/VIEW/RENDERING/renderTarget.h
>
14
#endif
15
16
namespace
BALL
17
{
18
namespace
VIEW
19
{
29
class
BufferedRenderer
30
:
public
Renderer
31
{
32
public
:
33
BufferedRenderer
()
34
:
Renderer
(),
35
bufferFormat
() { }
36
37
virtual
~BufferedRenderer
() throw() { }
38
43
bool
setFrameBufferFormat
(
const
FrameBufferFormat
&format)
44
{
45
if
(
supports
(format) )
46
{
47
bufferFormat
= format;
48
formatUpdated
();
49
return
true
;
50
}
51
52
return
false
;
53
}
54
59
void
renderToBuffer
(
RenderTarget
* renderTarget,
const
Stage
& stage)
60
throw
(
BALL::Exception::InvalidFormat
,
BALL::Exception::NoBufferAvailable
)
61
{
62
prepareBufferedRendering
(stage);
63
64
FrameBufferPtr
buffer = renderTarget->getBuffer();
65
assert(buffer);
66
67
if
(buffer->getFormat() !=
bufferFormat
)
68
{
69
throw
BALL::Exception::InvalidFormat
(__FILE__, __LINE__,
"Buffer with wrong framebuffer format supplied"
);
70
}
71
72
renderToBufferImpl
( buffer );
73
74
renderTarget->releaseBuffer(buffer);
75
}
76
78
virtual
bool
supports
(
const
PixelFormat
&format)
const
= 0;
79
86
virtual
Resolution
getSupportedResolution
(
87
const
Resolution
&
min
,
const
Resolution
&
max
,
88
const
PixelFormat
&format)
const
89
throw
(
BALL::Exception::FormatUnsupported
) = 0;
90
91
protected
:
92
98
virtual
bool
supports
(
const
FrameBufferFormat
&format)
const
= 0;
99
103
virtual
void
formatUpdated
() = 0;
104
107
virtual
void
prepareBufferedRendering
(
const
Stage
& stage) = 0;
108
113
virtual
void
renderToBufferImpl
(
FrameBufferPtr
buffer) = 0;
114
116
const
FrameBufferFormat
&
getFrameBufferFormat
()
const
117
{
return
bufferFormat
; }
118
119
private
:
120
121
FrameBufferFormat
bufferFormat
;
122
};
123
}
//namespace VIEW
124
125
}
//namespace BALL
126
127
128
#endif // BALL_VIEW_RENDERING_BUFFEREDRENDERER_H
Generated by
1.8.3.1