Equalizer  1.6.1
include/seq/renderer.h
1 
2 /* Copyright (c) 2011-2013, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQSEQUEL_RENDERER_H
19 #define EQSEQUEL_RENDERER_H
20 
21 #include <co/objectFactory.h> // interface
22 #include <seq/types.h>
23 
24 namespace seq
25 {
32  class Renderer : public co::ObjectFactory
33  {
34  public:
36  SEQ_API Renderer( Application& application );
37 
39  SEQ_API virtual ~Renderer();
40 
54  SEQ_API virtual bool init( co::Object* initData ) { return true; }
55 
65  SEQ_API virtual bool exit() { return true; }
66 
78  SEQ_API virtual bool initContext( co::Object* initData );
79 
87  SEQ_API virtual bool exitContext();
88 
96  SEQ_API virtual void clear( co::Object* frameData );
97 
105  virtual void draw( co::Object* frameData ) = 0;
106 
116  SEQ_API virtual void applyRenderContext();
117 
119  SEQ_API const RenderContext& getRenderContext() const;
120 
130  SEQ_API virtual void applyModelMatrix();
132 
135  detail::Renderer* getImpl() { return _impl; }
136  co::Object* getFrameData(); // @warning experimental
137 
139  Application& getApplication() { return _app; }
140 
142  const Application& getApplication() const { return _app; }
143 
154  SEQ_API virtual ViewData* createViewData();
155 
157  SEQ_API virtual void destroyViewData( ViewData* viewData );
158 
172  SEQ_API const GLEWContext* glewGetContext() const;
173 
175  SEQ_API const Frustumf& getFrustum() const;
176 
178  SEQ_API const Matrix4f& getViewMatrix() const;
179 
181  SEQ_API const Matrix4f& getModelMatrix() const;
183 
186  SEQ_API virtual co::Object* createObject( const uint32_t type );
187  SEQ_API virtual void destroyObject( co::Object* object,
188  const uint32_t type );
190 
191  private:
192  detail::Renderer* const _impl;
193  Application& _app;
194  };
195 }
196 #endif // EQSEQUEL_RENDERER_H
The main application object.
Renderer(Application &application)
Construct a new renderer.
virtual void draw(co::Object *frameData)=0
Render the scene.
The context applied to a channel during rendering operations.
Definition: renderContext.h:38
virtual bool exitContext()
De-initialize an OpenGL context.
virtual void applyModelMatrix()
Apply the current model matrix to OpenGL.
const RenderContext & getRenderContext() const
virtual bool init(co::Object *initData)
Initialize the renderer.
const Frustumf & getFrustum() const
const GLEWContext * glewGetContext() const
Get the GLEW context for this renderer.
virtual ~Renderer()
Destruct this renderer.
virtual void destroyViewData(ViewData *viewData)
Delete the given view data.
Application & getApplication()
virtual ViewData * createViewData()
Create a new per-view data instance.
const Application & getApplication() const
const Matrix4f & getViewMatrix() const
virtual bool exit()
De-initialize the renderer.
virtual void clear(co::Object *frameData)
Clear the frame buffer.
virtual void applyRenderContext()
Apply the current rendering parameters to OpenGL.
Stores per-view data.
Definition: viewData.h:29
const Matrix4f & getModelMatrix() const
virtual bool initContext(co::Object *initData)
Initialize an OpenGL context.
A renderer instance.