Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Renderer.cpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2011, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
33 #include <vlCore/Say.hpp>
34 #include <vlGraphics/Renderer.hpp>
36 #include <vlGraphics/GLSL.hpp>
38 #include <vlCore/Log.hpp>
39 
40 using namespace vl;
41 
42 //------------------------------------------------------------------------------
43 // Renderer
44 //------------------------------------------------------------------------------
46 {
47  VL_DEBUG_SET_OBJECT_NAME()
48 
50 
53 }
54 //------------------------------------------------------------------------------
55 namespace
56 {
57  struct GLSLProgState
58  {
59  public:
60  GLSLProgState(): mCamera(NULL), mTransform(NULL), mGLSLProgUniformSet(NULL), mShaderUniformSet(NULL), mActorUniformSet(NULL) {}
61 
62  bool operator<(const GLSLProgState& other) const
63  {
64  if ( mCamera != other.mCamera )
65  return mCamera < other.mCamera;
66  else
67  if ( mTransform != other.mTransform )
68  return mTransform < other.mTransform;
69  else
70  if ( mGLSLProgUniformSet != other.mGLSLProgUniformSet )
71  return mGLSLProgUniformSet < other.mGLSLProgUniformSet;
72  else
73  if ( mShaderUniformSet != other.mShaderUniformSet )
74  return mShaderUniformSet < other.mShaderUniformSet;
75  else
76  return mActorUniformSet < other.mActorUniformSet;
77  }
78 
79  const Camera* mCamera;
80  const Transform* mTransform;
81  const UniformSet* mGLSLProgUniformSet;
82  const UniformSet* mShaderUniformSet;
83  const UniformSet* mActorUniformSet;
84  };
85 }
86 //------------------------------------------------------------------------------
87 const RenderQueue* Renderer::renderRaw(const RenderQueue* render_queue, Camera* camera, real frame_clock) {
88 
89  // FIXME: use a small & simple hash-map<int, GLSLProgState> allocated on the stack
90  // mapping the GLSL program ID to the corresponding GLSLProgState.
91  std::map<const GLSLProgram*, GLSLProgState> glslprogram_map;
92 
93  OpenGLContext* opengl_context = framebuffer()->openglContext();
94 
95  // --------------- default scissor ---------------
96 
97  // non GLSLProgram state sets
98  const RenderStateSet* cur_render_state_set = NULL;
99  const EnableSet* cur_enable_set = NULL;
100  const Scissor* cur_scissor = NULL;
101 
102  // scissor the viewport by default: needed for points and lines since they are not clipped against the viewport
103  // this is already setup by the Viewport
104  /*
105  glEnable(GL_SCISSOR_TEST);
106  glScissor(camera->viewport()->x(), camera->viewport()->y(), camera->viewport()->width(), camera->viewport()->height());
107  */
108 
109  // --------------- rendering ---------------
110 
111  for(int itok=0; itok < render_queue->size(); ++itok)
112  {
113  const RenderToken* tok = render_queue->at(itok); VL_CHECK(tok);
114  Actor* actor = tok->mActor; VL_CHECK(actor);
115 
116  if ( ! isEnabled( actor ) ) {
117  continue;
118  }
119 
120  // --------------- Actor's scissor ---------------
121 
122  // MIC FIXME:
123  // this kind of scissor management is not particularly elegant.
124  // It is required mainly for convenience for the vector graphics that allow the specification of a clipping
125  // rectangular area at any point in the rendering. We must also find a good general solution to support
126  // indexed scissoring and viewport.
127 
128  const Scissor* scissor = actor->scissor() ? actor->scissor() : tok->mShader->scissor();
129  if (cur_scissor != scissor)
130  {
131  cur_scissor = scissor;
132  if (cur_scissor)
133  {
134  cur_scissor->enable(camera->viewport());
135  }
136  else
137  {
138  // scissor the viewport by default: needed for points and lines with size > 1.0 as they are not clipped against the viewport.
139  VL_CHECK(glIsEnabled(GL_SCISSOR_TEST))
140  glScissor(camera->viewport()->x(), camera->viewport()->y(), camera->viewport()->width(), camera->viewport()->height());
141  }
142  }
143 
144  // multipassing
145  for( int ipass=0; tok != NULL; tok = tok->mNextPass, ++ipass )
146  {
147  VL_CHECK_OGL()
148 
149  // --------------- shader setup ---------------
150 
151  const Shader* shader = tok->mShader;
152 
153  // shader override: select the first that matches
154 
155  for( std::map< unsigned int, ref<Shader> >::const_iterator eom_it = mShaderOverrideMask.begin();
156  eom_it != mShaderOverrideMask.end();
157  ++eom_it )
158  {
159  if ( eom_it->first & actor->enableMask() )
160  {
161  shader = eom_it->second.get();
162  break;
163  }
164  }
165 
166  // shader's render states
167 
168  if ( cur_render_state_set != shader->getRenderStateSet() )
169  {
170  opengl_context->applyRenderStates( shader->getRenderStateSet(), camera );
171  cur_render_state_set = shader->getRenderStateSet();
172  }
173 
174  VL_CHECK_OGL()
175 
176  // shader's enables
177 
178  if ( cur_enable_set != shader->getEnableSet() )
179  {
180  opengl_context->applyEnables( shader->getEnableSet() );
181  cur_enable_set = shader->getEnableSet();
182  }
183 
184  #ifndef NDEBUG
185  if (glGetError() != GL_NO_ERROR)
186  {
187  Log::error("An unsupported OpenGL glEnable/glDisable capability has been enabled!\n");
188  VL_TRAP()
189  }
190  #endif
191 
192  // --------------- Actor pre-render callback ---------------
193 
194  // here the user has still the possibility to modify the Actor's uniforms
195 
196  actor->dispatchOnActorRenderStarted( frame_clock, camera, tok->mRenderable, shader, ipass );
197 
198  VL_CHECK_OGL()
199 
200  // --------------- GLSLProgram setup ---------------
201 
202  VL_CHECK_OGL()
203 
204  // current transform
205  const Transform* cur_transform = actor->transform();
206  const GLSLProgram* cur_glsl_program = NULL; // NULL == fixed function pipeline
207  const UniformSet* cur_glsl_prog_uniform_set = NULL;
208  const UniformSet* cur_shader_uniform_set = NULL;
209  const UniformSet* cur_actor_uniform_set = NULL;
210 
211  // make sure we update these things only if there is a valid GLSLProgram
212  if ( shader->glslProgram() && shader->glslProgram()->handle() && shader->glslProgram()->linked() )
213  {
214  cur_glsl_program = shader->glslProgram();
215 
216  // consider them NULL if they are empty
217  if (cur_glsl_program->getUniformSet() && !cur_glsl_program->getUniformSet()->uniforms().empty())
218  cur_glsl_prog_uniform_set = cur_glsl_program->getUniformSet();
219 
220  if (shader->getUniformSet() && !shader->getUniformSet()->uniforms().empty())
221  cur_shader_uniform_set = shader->getUniformSet();
222 
223  if (actor->getUniformSet() && !actor->getUniformSet()->uniforms().empty())
224  cur_actor_uniform_set = actor->getUniformSet();
225  }
226 
227  bool update_cm = false; // update camera
228  bool update_tr = false; // update transform
229  bool update_pu = false; // update glsl-program uniforms
230  bool update_su = false; // update shader uniforms
231  bool update_au = false; // update actor uniforms
232  GLSLProgState* glsl_state = NULL;
233 
234  // retrieve the state of this GLSLProgram (including the NULL one)
235  std::map<const GLSLProgram*, GLSLProgState>::iterator glsl_state_it = glslprogram_map.find(cur_glsl_program);
236 
237  if ( glsl_state_it == glslprogram_map.end() )
238  {
239  //
240  // this is the first time we see this GLSL program so we update everything we can
241  //
242 
243  // create a new glsl-state entry
244  glsl_state = &glslprogram_map[cur_glsl_program];
245  update_cm = true;
246  update_tr = true;
247  update_pu = cur_glsl_prog_uniform_set != NULL;
248  update_su = cur_shader_uniform_set != NULL;
249  update_au = cur_actor_uniform_set != NULL;
250  }
251  else
252  {
253  //
254  // we already know this GLSLProgram so we update only what has changed since last time
255  //
256 
257  glsl_state = &glsl_state_it->second;
258  // check for differences
259  update_cm = glsl_state->mCamera != camera;
260  update_tr = glsl_state->mTransform != cur_transform;
261  update_pu = glsl_state->mGLSLProgUniformSet != cur_glsl_prog_uniform_set && cur_glsl_prog_uniform_set != NULL;
262  update_su = glsl_state->mShaderUniformSet != cur_shader_uniform_set && cur_shader_uniform_set != NULL;
263  update_au = glsl_state->mActorUniformSet != cur_actor_uniform_set && cur_actor_uniform_set != NULL;
264  }
265 
266  // update glsl-state structure
267  glsl_state->mCamera = camera;
268  glsl_state->mTransform = cur_transform;
269  glsl_state->mGLSLProgUniformSet = cur_glsl_prog_uniform_set;
270  glsl_state->mShaderUniformSet = cur_shader_uniform_set;
271  glsl_state->mActorUniformSet = cur_actor_uniform_set;
272 
273  // --- update proj, view and transform matrices ---
274 
275  VL_CHECK_OGL()
276 
277  if (update_cm || update_tr) {
278  projViewTransfCallback()->updateMatrices( update_cm, update_tr, cur_glsl_program, camera, cur_transform );
279  }
280 
281  VL_CHECK_OGL()
282 
283  // --- uniforms ---
284 
285  // note: the user must not make the glslprogram's, shader's and actor's uniforms collide!
286  VL_CHECK( !opengl_context->areUniformsColliding(cur_shader_uniform_set, cur_actor_uniform_set) );
287  VL_CHECK( !opengl_context->areUniformsColliding(cur_shader_uniform_set, cur_glsl_prog_uniform_set ) );
288  VL_CHECK( !opengl_context->areUniformsColliding(cur_actor_uniform_set, cur_glsl_prog_uniform_set ) );
289 
290  VL_CHECK_OGL()
291 
292  // glsl program uniform set
293  if ( update_pu )
294  {
295  VL_CHECK( cur_glsl_prog_uniform_set && cur_glsl_prog_uniform_set->uniforms().size() );
296  VL_CHECK( shader->getRenderStateSet()->glslProgram() && shader->getRenderStateSet()->glslProgram()->handle() )
297  cur_glsl_program->applyUniformSet( cur_glsl_prog_uniform_set );
298  }
299 
300  VL_CHECK_OGL()
301 
302  // shader uniform set
303  if ( update_su )
304  {
305  VL_CHECK( cur_shader_uniform_set && cur_shader_uniform_set->uniforms().size() );
306  VL_CHECK( shader->getRenderStateSet()->glslProgram() && shader->getRenderStateSet()->glslProgram()->handle() )
307  cur_glsl_program->applyUniformSet( cur_shader_uniform_set );
308  }
309 
310  VL_CHECK_OGL()
311 
312  // actor uniform set
313  if ( update_au )
314  {
315  VL_CHECK( cur_actor_uniform_set && cur_actor_uniform_set->uniforms().size() );
316  VL_CHECK( shader->getRenderStateSet()->glslProgram() && shader->getRenderStateSet()->glslProgram()->handle() )
317  cur_glsl_program->applyUniformSet( cur_actor_uniform_set );
318  }
319 
320  VL_CHECK_OGL()
321 
322  #ifndef NDEBUG
323  if ( cur_glsl_program && ! cur_glsl_program->validateProgram() ) {
324  Log::bug( "GLSLProgram::useProgram() failed validation (" + String(objectName()) + ")\n");
325  Log::bug( Say("Info log:\n%s\n") << cur_glsl_program->infoLog() );
326  VL_TRAP();
327  }
328  #endif
329 
330  // --------------- Actor rendering ---------------
331 
332  // also compiles display lists and updates BufferObjects if necessary
333  tok->mRenderable->render( actor, shader, camera, opengl_context );
334 
335  VL_CHECK_OGL()
336 
337  // if shader is overridden it does not make sense to perform multipassing so we break the loop here.
338  if (shader != tok->mShader)
339  break;
340  }
341  }
342 
343  // clear enables
344  opengl_context->applyEnables( mDummyEnables.get() ); VL_CHECK_OGL();
345 
346  // clear render states
347  opengl_context->applyRenderStates( mDummyStateSet.get(), NULL ); VL_CHECK_OGL();
348 
349  // enabled texture unit #0
350  VL_glActiveTexture( GL_TEXTURE0 ); VL_CHECK_OGL();
352  VL_glClientActiveTexture( GL_TEXTURE0 ); VL_CHECK_OGL();
353  }
354 
355  // disable scissor test
356  glDisable( GL_SCISSOR_TEST ); VL_CHECK_OGL();
357 
358  // disable all vertex arrays, note this also calls "glBindBuffer(GL_ARRAY_BUFFER, 0)"
359  opengl_context->bindVAS( NULL, false, false ); VL_CHECK_OGL();
360 
361  return render_queue;
362 }
363 //------------------------------------------------------------------------------
364 const RenderQueue* Renderer::render(const RenderQueue* render_queue, Camera* camera, real frame_clock)
365 {
366  VL_CHECK_OGL()
367 
368  // skip if renderer is disabled
369 
370  if ( enableMask() == 0 ) {
371  return render_queue;
372  }
373 
374  // enter/exit behavior contract
375 
376  class InOutContract
377  {
378  Renderer* mRenderer;
379  std::vector<RenderStateSlot> mOriginalDefaultRS;
380  public:
381  InOutContract(Renderer* renderer, Camera* camera): mRenderer(renderer)
382  {
383  // increment the render tick.
384  mRenderer->mRenderTick++;
385 
386  // render-target activation.
387  // note: an OpenGL context can have multiple rendering targets!
388  mRenderer->framebuffer()->activate();
389 
390  // viewport setup.
391  camera->viewport()->setClearFlags( mRenderer->clearFlags() );
392  camera->viewport()->activate();
393 
394  OpenGLContext* gl_context = renderer->framebuffer()->openglContext();
395 
396  // default render states override
397  for(size_t i=0; i<renderer->overriddenDefaultRenderStates().size(); ++i)
398  {
399  // save overridden default render state to be restored later
400  ERenderState type = renderer->overriddenDefaultRenderStates()[i].type();
401  mOriginalDefaultRS.push_back(gl_context->defaultRenderState(type));
402  // set new default render state
403  gl_context->setDefaultRenderState(renderer->overriddenDefaultRenderStates()[i]);
404  }
405 
406  // dispatch the renderer-started event.
407  mRenderer->dispatchOnRendererStarted();
408 
409  // check user-generated errors.
410  VL_CHECK_OGL()
411  }
412 
413  ~InOutContract()
414  {
415  // dispatch the renderer-finished event
416  mRenderer->dispatchOnRendererFinished();
417 
418  OpenGLContext* gl_context = mRenderer->framebuffer()->openglContext();
419 
420  // restore default render states
421  for(size_t i=0; i<mOriginalDefaultRS.size(); ++i)
422  {
423  gl_context->setDefaultRenderState(mOriginalDefaultRS[i]);
424  }
425 
426  VL_CHECK( !globalSettings()->checkOpenGLStates() || mRenderer->framebuffer()->openglContext()->isCleanState(true) );
427 
428  // check user-generated errors.
429  VL_CHECK_OGL()
430 
431  // note: we don't reset the render target here
432  }
433  } contract(this, camera);
434 
435  return renderRaw( render_queue, camera, frame_clock );
436 }
437 //-----------------------------------------------------------------------------
Associates a Renderable object to an Effect and Transform.
Definition: Actor.hpp:130
int y() const
Definition: Viewport.hpp:67
Callback class to update the state of the projection, view, transform and normal matrices of a GLSLPr...
const ProjViewTransfCallback * projViewTransfCallback() const
Definition: Renderer.hpp:68
Transform * transform()
Returns the Transform bound tho an Actor.
Definition: Actor.hpp:190
Implements a 4x4 matrix transform used to define the position and orientation of an Actor...
Definition: Transform.hpp:72
const Framebuffer * framebuffer() const
The Framebuffer on which the rendering is performed.
Definition: Renderer.hpp:99
ERenderState
The Renderer class executes the actual rendering on the given RenderQueue.
Definition: Renderer.hpp:48
A simple String formatting class.
Definition: Say.hpp:124
void applyEnables(const EnableSet *cur)
Applies an EnableSet to an OpenGLContext - Typically for internal use only.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
ref< ProjViewTransfCallback > mProjViewTransfCallback
Definition: Renderer.hpp:115
int size() const
Definition: RenderQueue.hpp:90
vl::ref< EnableSet > mDummyEnables
Definition: Renderer.hpp:108
EnableSet * getEnableSet()
Definition: Shader.hpp:2240
bool linked() const
Returns true if the program has been succesfully linked.
Definition: GLSL.hpp:288
Renderable * mRenderable
Definition: RenderToken.hpp:59
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
Definition: Log.cpp:164
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
Definition: GLSL.hpp:233
bool validateProgram() const
Returns true if the validation of this GLSL program is succesful, see also http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml for more information.
Definition: GLSL.cpp:615
std::map< unsigned int, ref< Shader > > mShaderOverrideMask
Definition: Renderer.hpp:111
void setDefaultRenderState(const RenderStateSlot &rs_slot)
Defines the default render state slot to be used by the opengl context.
const UniformSet * getUniformSet() const
Returns the installed UniformSet.
Definition: Actor.hpp:345
bool applyUniformSet(const UniformSet *uniforms=NULL) const
Applies a set of uniforms to the currently bound GLSL program.
Definition: GLSL.cpp:652
const std::vector< ref< Uniform > > & uniforms() const
Definition: UniformSet.hpp:68
const GLSLProgram * glslProgram() const
Returns the GLSLProgram associated to a RenderStateSet (if any)
Internally used by the rendering engine.
Definition: RenderToken.hpp:47
void dispatchOnRendererFinished()
Dispatches the onRendererFinished() event to the registered RenderEventCallback objects.
unsigned int enableMask() const
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
Definition: Actor.hpp:270
Viewport * viewport()
The viewport bound to a camera.
Definition: Camera.hpp:141
Visualization Library main namespace.
void activate() const
Definition: Viewport.cpp:72
static void bug(const String &message)
Use this function to provide information about programming errors: wrong parameter initialization...
Definition: Log.cpp:174
int height() const
Definition: Viewport.hpp:71
const Scissor * scissor() const
Returns the Scissor used when rendering an Actor.
Definition: Actor.hpp:411
std::vector< RenderStateSlot > & overriddenDefaultRenderStates()
Render states that will be used as default by the opengl context by this renderer.
Definition: Renderer.hpp:86
#define VL_TRAP()
Definition: checks.hpp:70
int width() const
Definition: Viewport.hpp:69
const RenderQueue * renderRaw(const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
Used by render() to loop through the render queue.
Definition: Renderer.cpp:87
UniformSet * getUniformSet()
Returns a GLSLProgram&#39;s static UniformSet. Static uniforms are those uniforms whose value is constant...
Definition: GLSL.hpp:470
const Shader * mShader
Definition: RenderToken.hpp:60
vl::ref< RenderStateSet > mDummyStateSet
Definition: Renderer.hpp:109
int x() const
Definition: Viewport.hpp:65
void dispatchOnActorRenderStarted(real frame_clock, const Camera *camera, Renderable *renderable, const Shader *shader, int pass)
Calls all the onActorRenderStarted() of all the ActorEventCallback installed on this Actor...
Definition: Actor.hpp:376
String infoLog() const
Returns the info log of this GLSL program using the OpenGL function glGetProgramInfoLog(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml for more information.
Definition: GLSL.cpp:593
void applyRenderStates(const RenderStateSet *cur, const Camera *camera)
Applies a RenderStateSet to an OpenGLContext - Typically for internal use only.
#define NULL
Definition: OpenGLDefs.hpp:81
bool isEnabled(unsigned int mask)
Definition: Renderer.hpp:92
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
Definition: Shader.hpp:1841
void render(const Actor *actor, const Shader *shader, const Camera *camera, OpenGLContext *gl_context)
Renders the Renderable and if necessary compiles the display list and updates the BufferObjects...
Definition: Renderable.hpp:76
A set of RenderState objects managed by a Shader.
const Scissor * scissor() const
Returns the Scissor to be used when rendering an Actor.
Definition: Shader.hpp:2320
void activate(EFramebufferBind target=FBB_FRAMEBUFFER)
Activates the Framebuffer by calling bindFramebuffer() and bindDrawBuffers()
Definition: Framebuffer.hpp:87
The RenderQueue class collects a list of RenderToken objects to be sorted and rendered.
Definition: RenderQueue.hpp:45
OpenGLContext * openglContext()
The OpenGLContext bound to a render target.
Definition: Framebuffer.hpp:66
virtual const RenderQueue * render(const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
Takes as input the render queue to render and returns a possibly filtered render queue for further pr...
Definition: Renderer.cpp:364
void bindVAS(const IVertexAttribSet *vas, bool use_vbo, bool force)
Activates the specified vertex attribute set - For internal use only.
bool isCleanState(bool verbose)
Checks whether the OpenGL state is clean or not.
#define VL_CHECK_OGL()
Definition: OpenGL.hpp:156
const std::string & objectName() const
The name of the object, by default set to the object&#39;s class name.
Definition: Object.hpp:217
virtual void updateMatrices(bool cam_changed, bool transf_changed, const GLSLProgram *glsl_program, const Camera *camera, const Transform *transform)
Update matrices of the current GLSLProgram, if glsl_program == NULL then fixed function pipeline is a...
UniformSet * getUniformSet()
Returns the UniformSet installed.
Definition: Shader.hpp:2272
RenderStateSet * getRenderStateSet()
Definition: Shader.hpp:2246
const RenderToken * at(int i) const
Definition: RenderQueue.hpp:57
A set of Uniform objects managed by a Shader.
Definition: UniformSet.hpp:50
bool Has_Fixed_Function_Pipeline
OpenGL: true if !Is_OpenGL_Forward_Compatible && !Is_OpenGL_Core_Profile OpenGL ES 1: always true Ope...
Definition: OpenGL.cpp:63
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:50
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
Definition: Scissor.hpp:47
unsigned int handle() const
The handle of the GLSL program as returned by glCreateProgram()
Definition: GLSL.hpp:273
const GLSLProgram * glslProgram() const
Returns the GLSLProgram associated to a Shader (if any)
Definition: Shader.hpp:2205
void enable(const Viewport *viewport) const
Enables the scissor test on the area specified by scissorRect() clipped against the given Viewport...
Definition: Scissor.hpp:61
const RenderToken * mNextPass
Definition: RenderToken.hpp:56
#define VL_CHECK(expr)
Definition: checks.hpp:73
unsigned int enableMask() const
Enable mask used to enable/disable the rendering of matching Actors.
EClearFlags clearFlags() const
The clear flags used to clear the viewport.
static bool areUniformsColliding(const UniformSet *u1, const UniformSet *u2)
Returns true if the two UniformSet contain at least one Uniform variable with the same name...
void dispatchOnRendererStarted()
Dispatches the onRendererStarted() event to the registered RenderEventCallback objects.
const RenderStateSlot & defaultRenderState(ERenderState rs)
Returns the default render state slot used by VL when a specific render state type is left undefined...
VLCORE_EXPORT GlobalSettings * globalSettings()
Returns VisulizationLibrary&#39;s global settings.
Definition: init_core.cpp:112
A set of enables managed by Shader.
Definition: EnableSet.hpp:47
void setClearFlags(EClearFlags clear_flags)
Usually you want to use rather RendererAbstract::setClearFlags()
Definition: Viewport.hpp:98