Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DeferredShading.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
5 * www.openflipper.org *
6 * *
7 *--------------------------------------------------------------------------- *
8 * This file is part of OpenFlipper. *
9 * *
10 * OpenFlipper is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenFlipper is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenFlipper. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36 * *
37 * $Revision: 18127 $ *
38 * $LastChangedBy: moebius $ *
39 * $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
40 * *
41 \*===========================================================================*/
42 
43 #include <ACG/GL/acg_glew.hh>
44 
45 #include "DeferredShading.hh"
46 
49 #include <ACG/GL/ShaderCache.hh>
50 #include <ACG/GL/ScreenQuad.hh>
51 #include <ACG/GL/GLError.hh>
52 #include <ACG/QtWidgets/QtColorChooserButton.hh>
53 
54 // =================================================
55 
56 #define GBUFFER_INCLUDE_FILE "DeferredShading/GBufferAccess.glsl"
57 
58 #define SCREENQUAD_VERTEXSHADER_FILE "DeferredShading/screenquad.glsl"
59 
60 #define PASS_EMISSIVE_FILE "DeferredShading/pass_emissive.glsl"
61 #define PASS_EMISSIVE_MS_FILE "DeferredShading/pass_emissiveMS.glsl"
62 
63 #define PASS_DIRECTIONAL_FILE "DeferredShading/pass_directional.glsl"
64 #define PASS_DIRECTIONAL_MS_FILE "DeferredShading/pass_directionalMS.glsl"
65 #define PASS_POINT_FILE "DeferredShading/pass_point.glsl"
66 #define PASS_POINT_MS_FILE "DeferredShading/pass_pointMS.glsl"
67 #define PASS_SPOT_FILE "DeferredShading/pass_spot.glsl"
68 #define PASS_SPOT_MS_FILE "DeferredShading/pass_spotMS.glsl"
69 
70 #define PASS_BACKGROUND_FILE "DeferredShading/pass_background.glsl"
71 
73 public:
74 
76  _shader->addOutput("vec3 outVertexNormal");
77  _shader->addOutput("vec4 outVertexPosVS");
78 
79  // force normal input
80  _shader->addInput("vec3 inNormal");
81  }
82 
84 
85  // include GBuffer functions
86  _shader->addIncludeFile(ACG::ShaderProgGenerator::getShaderDir() + QDir::separator() + QString(GBUFFER_INCLUDE_FILE));
87 
88  _shader->addInput("vec3 outVertexNormal");
89  _shader->addInput("vec4 outVertexPosVS");
90 
91  // write position, normal and material to mrt fbo
92  _shader->addOutput("vec3 outNormal");
93 
94 
95  _shader->addUniform("float materialID");
96  }
97 
98  void modifyVertexEndCode(QStringList* _code) {
99  _code->push_back("outVertexPosVS = sg_vPosVS;");
100  _code->push_back("outVertexNormal = g_mWVIT * inNormal;");
101  }
102 
103  void modifyFragmentEndCode(QStringList* _code) {
104  _code->push_back("outFragment = WritePositionVS(outVertexPosVS, materialID);");
105  _code->push_back("outNormal = WriteNormalVS(outVertexNormal);");
106  }
107 
108  // modifier replaces default lighting
109  bool replaceDefaultLightingCode() {return true;}
110 
111  void modifyLightingCode(QStringList* _code, int _lightId, ACG::ShaderGenLightType _lightType) {
112  // do nothing, lighting is deferred
113  }
114 
115 
116  static DeferredShadingInitPass instance;
117 };
118 
119 
120 DeferredShadingInitPass DeferredShadingInitPass::instance;
121 
122 // =================================================
123 
124 DeferredShading::DeferredShading()
125  : progEmissive_(0), progEmissiveMS_(0),
126  progBackground_(0),
127  progDirectional_(0), progDirectionalMS_(0),
128  progPoint_(0), progPointMS_(0),
129  progSpot_(0), progSpotMS_(0)
130 {
131  numSamples_ = 0;
132  ACG::ShaderProgGenerator::registerModifier(&DeferredShadingInitPass::instance);
133 }
134 
135 
136 DeferredShading::~DeferredShading() {
137  delete progEmissive_;
138  delete progEmissiveMS_;
139  delete progDirectional_;
140  delete progDirectionalMS_;
141  delete progPoint_;
142  delete progPointMS_;
143  delete progSpot_;
144  delete progSpotMS_;
145  delete progBackground_;
146 }
147 
148 
149 void DeferredShading::initializePlugin() {
150  ACG::ShaderProgGenerator::setShaderDir(OpenFlipper::Options::shaderDirStr());
151 }
152 
153 QString DeferredShading::renderObjectsInfo(bool _outputShaderInfo) {
154  std::vector<ACG::ShaderModifier*> modifiers;
155  modifiers.push_back(&DeferredShadingInitPass::instance);
156  return dumpCurrentRenderObjectsToString(&sortedObjects_[0], _outputShaderInfo, &modifiers);
157 }
158 
159 void DeferredShading::render(ACG::GLState* _glState, Viewer::ViewerProperties& _properties) {
160 
161 #ifdef GL_ARB_texture_buffer_object
162  // collect renderobjects + prepare OpenGL state
164 
165  // init/update fbos
166  ViewerResources* viewRes = &viewerRes_[_properties.viewerId()];
167  viewRes->resize(_glState->viewport_width(), _glState->viewport_height(), numSamples_);
168 
169  // update material buffer
170 
171  materialBufferData_.resize((getNumRenderObjects() + 1) * 5);
172 
173  // material 0 is used for the background
174  materialBufferData_[0] = ACG::Vec3f(.0f,.0f,.0f);
175  materialBufferData_[1] = ACG::Vec3f(.0f,.0f,.0f);
176  materialBufferData_[2] = ACG::Vec3f(.0f,.0f,.0f);
177  materialBufferData_[3] = ACG::Vec3f(.0f,.0f,.0f);
178  materialBufferData_[4] = ACG::Vec3f(1.0f,1.0f,0.0f);
179 
180  for (int i = 0; i < getNumRenderObjects(); ++i) {
181  int offset = (i + 1) * 5;
182 
183  materialBufferData_[offset + 0] = sortedObjects_[i]->emissive;
184  materialBufferData_[offset + 1] = sortedObjects_[i]->ambient;
185  materialBufferData_[offset + 2] = sortedObjects_[i]->diffuse;
186  materialBufferData_[offset + 3] = sortedObjects_[i]->specular;
187  materialBufferData_[offset + 4] = ACG::Vec3f(sortedObjects_[i]->alpha, sortedObjects_[i]->shininess, 1.0f);
188  }
189 
190  int matBufSize = (getNumRenderObjects() + 1) * 5 * 12;
191  if (matBufSize)
192  materialBuffer_.setBufferData(matBufSize, &materialBufferData_[0], GL_RGB32F, GL_DYNAMIC_DRAW);
193 
194 
195  // --------------------------------------------------
196  // 1st pass: draw scene to G-buffer
197 
198  // enable color/depth write access
199  glDepthMask(1);
200  glColorMask(1,1,1,1);
201 
202  // bind G-buffer fbo
203  viewRes->scene_->bind();
204  glViewport(0, 0, _glState->viewport_width(), _glState->viewport_height());
205 
206  // attachment0: depth view space, material id
207  // attachment1: normals
208  const GLenum colorTarget[2] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1};
209 
210  // set G-buffer to zero
211  for (int i = 0; i < 2; ++i) {
212  glDrawBuffer(colorTarget[i]);
213 
214  ACG::Vec4f clearColor(0.0f, 0.0f, 0.0f, 0.0f);
215 
216  glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
217  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
218  }
219 
220  // initialize G-buffer
221  glDrawBuffers(2, colorTarget);
222 
223  ACG::GLMatrixd matProj;
224  matProj.clear();
225 
226 
227  // render every object
228  for (int i = 0; i < getNumRenderObjects(); ++i) {
229 
230  // Take original shader and modify the output to output position, normal and material
231  GLSL::Program* prog = ACG::ShaderCache::getInstance()->getProgram(&sortedObjects_[i]->shaderDesc, DeferredShadingInitPass::instance);
232 
233  int bRelink = 0;
234  if (prog->getFragDataLocation("outFragment") != 0) {
235  prog->bindFragDataLocation(0, "outFragment");
236  bRelink++;
237  }
238  if (prog->getFragDataLocation("outNormal") != 1) {
239  prog->bindFragDataLocation(1, "outNormal");
240  bRelink++;
241  }
242  if (bRelink)
243  prog->link();
244 
245  prog->use();
246 
247  prog->setUniform("materialID", GLfloat(i+1));
248 
249 
250  renderObject(sortedObjects_[i], prog);
251 
252 
253  std::string objName = sortedObjects_[i]->debugName;
254 
255  if (matProj(0,0) == 0.0)
256  matProj = sortedObjects_[i]->proj;
257 
258  // prefer to use the projection matrix of a mesh node
259  if (objName.compare("MeshNode") == 0)
260  matProj = sortedObjects_[i]->proj;
261  }
262 
263  // extract near and far clipping planes
264  const ACG::Vec2f clipPlanes(float(matProj(2,3) / (matProj(2,2) - 1.0)), float(matProj(2,3) / (matProj(2,2) + 1.0)));
265 
266  viewRes->scene_->unbind();
267 
268  // ----------------------------------------------------------
269  // lighting passes
270 
271  // enable/disable multisampling
272  if (numSamples_) {
273  ACG::MSFilterWeights filterWeights(numSamples_);
274  filterWeights.asTextureBuffer(filterWeightsBuffer_);
275  }
276 
277  // load lighting shaders if not initialized
278  if (!progDirectional_)
279  reloadShaders();
280 
281 
282  // restore previous fbo
283  restoreInputFbo();
284 
285  // enable color/depth write access
286  glDepthMask(1);
287  glColorMask(1,1,1,1);
288 
289  // note: using glDisable(GL_DEPTH_TEST) not only disables depth testing,
290  // but actually discards any write operations to the depth buffer.
291  // However, we can provide scene depth for further post-processing.
292  // -> Enable depth testing with func=always
293  glEnable(GL_DEPTH_TEST);
294  glDepthFunc(GL_ALWAYS);
295 
296  // enable additive blending
297  glEnable(GL_BLEND);
298  glBlendFunc(GL_ONE, GL_ONE);
299 
300 
301  // set input fbo to zero, as we use additive blending from now on
302  clearInputFbo(ACG::Vec4f(0.0f, 0.0f, 0.0f, 0.0f));
303 
304 
305  // emission color pass
306  // maybe do check if necessary here, to avoid drawing black screenquad with no effect
307 
308  {
309  GLSL::Program* passShader = numSamples_ ? progEmissiveMS_ : progEmissive_;
310 
311  // setup emissive shader
312  passShader->use();
313  passShader->setUniform("samplerPos", 0);
314  passShader->setUniform("samplerMaterial", 6);
315 
316  passShader->setUniform("projParams", ACG::Vec4f(matProj(0,0), matProj(1,1), matProj(2,2), matProj(2,3)) );
317  passShader->setUniform("clipPlanes", clipPlanes);
318 
319  if (numSamples_) {
320  passShader->setUniform("numSamples", numSamples_);
321  passShader->setUniform("samplerFilterWeights", 7);
322 
323  filterWeightsBuffer_.bind(GL_TEXTURE7);
324  }
325 
326  materialBuffer_.bind(GL_TEXTURE6);
327 
328  for (int i = 1; i >= 0; --i){
329  glActiveTexture(GL_TEXTURE0 + i);
330 
331  glBindTexture(numSamples_ ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, viewRes->scene_->getAttachment(GL_COLOR_ATTACHMENT0 + i));
332  }
333 
334 
335  ACG::ScreenQuad::draw(passShader);
336 
337  passShader->disable();
338  }
339 
340 
341  for (int lightID = 0; lightID < numLights_; ++lightID) {
342  const LightData* lgt = lights_ + lightID;
343 
344  // choose shader based on light type and multisampling
345  GLSL::Program* passShader = 0;
346 
347  if (lgt->ltype == ACG::SG_LIGHT_DIRECTIONAL)
348  passShader = numSamples_ ? progDirectionalMS_ : progDirectional_;
349  else if (lgt->ltype == ACG::SG_LIGHT_SPOT)
350  passShader = numSamples_ ? progSpotMS_ : progSpot_;
351  else
352  passShader = numSamples_ ? progPointMS_ : progPoint_;
353 
354  // setup lighting shader
355  passShader->use();
356  passShader->setUniform("samplerPos", 0);
357  passShader->setUniform("samplerNormal", 1);
358  passShader->setUniform("samplerMaterial", 6);
359 
360  passShader->setUniform("lightDir", lgt->dir);
361  passShader->setUniform("lightPos", lgt->pos);
362 
363  passShader->setUniform("lightAtten", lgt->atten);
364 
365  if (lgt->ltype == ACG::SG_LIGHT_SPOT) {
366  passShader->setUniform("lightSpotDir", lgt->dir);
367  passShader->setUniform("lightSpotParam", lgt->spotCutoffExponent);
368  }
369 
370 
371  passShader->setUniform("lightAmbient", lgt->ambient);
372  passShader->setUniform("lightDiffuse", lgt->diffuse);
373  passShader->setUniform("lightSpecular", lgt->specular);
374 
375  passShader->setUniform("projParams", ACG::Vec4f(matProj(0,0), matProj(1,1), matProj(2,2), matProj(2,3)) );
376  passShader->setUniform("clipPlanes", clipPlanes);
377 
378 
379  if (numSamples_) {
380  passShader->setUniform("numSamples", numSamples_);
381  passShader->setUniform("samplerFilterWeights", 7);
382 
383  filterWeightsBuffer_.bind(GL_TEXTURE7);
384  }
385 
386  materialBuffer_.bind(GL_TEXTURE6);
387 
388  for (int i = 1; i >= 0; --i){
389  glActiveTexture(GL_TEXTURE0 + i);
390 
391  glBindTexture(numSamples_ ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, viewRes->scene_->getAttachment(GL_COLOR_ATTACHMENT0 + i));
392  }
393 
394 
395  ACG::ScreenQuad::draw(passShader);
396 
397  passShader->disable();
398  }
399 
400  // draw background color with z-culling
401  glDepthFunc(GL_LEQUAL);
402 
403  progBackground_->use();
404  progBackground_->setUniform("bkColor", _properties.backgroundColor());
407 
408 
409 
410  // reset depth func and blending to opengl default
411  glDepthFunc(GL_LESS);
412  glDisable(GL_BLEND);
413  glBlendFunc(GL_ONE, GL_ZERO);
414 
416 
417  // restore common opengl state
418  // log window remains hidden otherwise
420 
421 #endif
422 
423 }
424 
425 
426 
427 void DeferredShading::reloadShaders() {
428  const int numShaders = 9;
429 
430  GLSL::Program** ptrShaders[numShaders] =
431  {
437  };
438 
439  const char* shaderFiles[numShaders] =
440  {
441  PASS_EMISSIVE_FILE, PASS_EMISSIVE_MS_FILE,
442  PASS_BACKGROUND_FILE,
443  PASS_DIRECTIONAL_FILE, PASS_DIRECTIONAL_MS_FILE,
444  PASS_POINT_FILE, PASS_POINT_MS_FILE,
445  PASS_SPOT_FILE, PASS_SPOT_MS_FILE,
446  };
447 
448  for (int i = 0; i < numShaders; ++i){
449  GLSL::Program* prog = GLSL::loadProgram(SCREENQUAD_VERTEXSHADER_FILE, shaderFiles[i]);
450 
451  if (prog){
452  delete *(ptrShaders[i]);
453  *(ptrShaders[i]) = prog;
454  }
455  }
456 }
457 
458 void DeferredShading::ViewerResources::resize( int _newWidth, int _newHeight, int& _numSamples ) {
459  if (!_newHeight || !_newWidth) return;
460 
461 // if (!scene_) {
462  if (!scene_ || scene_->getMultisamplingCount() != _numSamples) {
463  delete scene_;
464  // scene fbo with 2 color attachments + depth buffer
465  // attachment0: view space depth, material id (RG32F)
466  // attachment1: normals (r8g8b8 color coded normal texture)
467  scene_ = new ACG::FBO();
468  scene_->init();
469  scene_->setMultisampling(_numSamples, GL_TRUE);
470 
471  scene_->attachTexture2D(GL_COLOR_ATTACHMENT0, _newWidth, _newHeight, GL_RG32F, GL_RG);
472  scene_->attachTexture2D(GL_COLOR_ATTACHMENT1, _newWidth, _newHeight, GL_RGB, GL_RGB);
473 
474 // scene_->attachTexture2DDepth(_newWidth, _newHeight);
475  scene_->addDepthBuffer(_newWidth, _newHeight);
476  }
477 
478  _numSamples = scene_->setMultisampling(_numSamples, GL_TRUE);
479  scene_->resize(_newWidth, _newHeight);
480 
481 }
482 
483 void DeferredShading::slotMSAASelection( QAction * _action) {
484  if ( _action->text() == "0x MSAA") {
485  numSamples_ = 0;
486  } else if ( _action->text() == "2x MSAA") {
487  numSamples_ = 2;
488  } else if ( _action->text() == "4x MSAA") {
489  numSamples_ = 4;
490  } else if ( _action->text() == "8x MSAA") {
491  numSamples_ = 8;
492  } else {
493  std::cerr << "Error : optionHandling unable to find MSAA selection!!! " << _action->text().toStdString() << std::endl;
494  numSamples_ = 0;
495  }
496 
497  // also reload shaders
498  reloadShaders();
499 }
500 
501 
502 #if QT_VERSION < 0x050000
503  Q_EXPORT_PLUGIN2( deferredshading , DeferredShading );
504 #endif
505 
void modifyFragmentEndCode(QStringList *_code)
Append code the the fragment shader.
int viewport_width() const
get viewport width
Definition: GLState.hh:825
GLSL::Program * progSpot_
spot lighting pass
void clear()
sets all elements to zero
Definition: Matrix4x4T.cc:240
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
Definition: ScreenQuad.cc:147
virtual void finishRenderingPipeline(bool _drawOverlay=true)
Draw overlay objects and reset OpenGL state.
Definition: IRenderer.cc:654
GLSL::Program * progBackground_
background color pass
int numLights_
Number of Lights.
Definition: IRenderer.hh:497
std::map< int, ViewerResources > viewerRes_
void link()
Links the shader objects to the program.
Definition: GLSLShader.cc:332
LightData lights_[SG_MAX_SHADER_LIGHTS]
Light sources ( Filled by addLight() )
Definition: IRenderer.hh:500
bool replaceDefaultLightingCode()
Specify whether this modifier replaces or extends the default lighting code.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
Definition: ShaderCache.cc:90
void init()
function to generate the framebuffer object
Definition: FBO.cc:86
void modifyFragmentIO(ACG::ShaderGenerator *_shader)
Add your own inputs/outputs to the fragment shader.
std::vector< ACG::RenderObject * > sortedObjects_
sorted list of renderobjects without overlay objects (sorted in rendering order)
Definition: IRenderer.hh:515
virtual QString dumpCurrentRenderObjectsToString(ACG::RenderObject **_list=0, bool _outputShaders=false, std::vector< ACG::ShaderModifier * > *_modifiers=0)
Outputs the current render objects to the string.
Definition: IRenderer.cc:1250
void glCheckErrors()
Definition: GLError.hh:105
GLSL::Program * progEmissive_
emissive color pass
GLsizei getMultisamplingCount() const
get number of samples
Definition: FBO.hh:105
int viewerId()
Get the id of the viewer this viewerproperties belongs to.
void bindFragDataLocation(unsigned int _index, const char *_name)
Bind fragment output data to name.
Definition: GLSLShader.cc:698
static void setShaderDir(QString _dir)
void addOutput(const QString &_output)
Add one GLSL output specifier.
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
Definition: GLSLShader.cc:391
void modifyLightingCode(QStringList *_code, int _lightId, ACG::ShaderGenLightType _lightType)
Modify the default lighting code of the shader generator.
GLSL::Program * progDirectionalMS_
directional lighting pass with multisampling
void attachTexture2D(GLenum _attachment, GLsizei _width, GLsizei _height, GLuint _internalFmt, GLenum _format, GLint _wrapMode=GL_CLAMP, GLint _minFilter=GL_NEAREST, GLint _magFilter=GL_NEAREST)
function to attach a texture to fbo
Definition: FBO.cc:200
void addInput(const QString &_input)
Add one GLSL input specifier.
GLsizei setMultisampling(GLsizei _samples, GLboolean _fixedsamplelocations=GL_TRUE)
Definition: FBO.cc:602
void addIncludeFile(QString _fileName)
Imports another shader, same as #include.
GLSL::Program * progEmissiveMS_
emissive color pass with multisampling
VectorT< float, 3 > Vec3f
Definition: VectorT.hh:125
virtual void renderObject(ACG::RenderObject *_obj, GLSL::Program *_prog=0, bool _constRenderStates=false, const std::vector< unsigned int > *_shaderModifiers=0)
Render one renderobject.
Definition: IRenderer.cc:1107
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
Definition: ShaderCache.cc:108
virtual void clearInputFbo(const ACG::Vec4f &_clearColor)
Clear input Fbo.
Definition: IRenderer.cc:789
Definition: FBO.hh:83
void modifyVertexIO(ACG::ShaderGenerator *_shader)
Add your own inputs/outputs to the vertex shader.
void addDepthBuffer(GLuint _width, GLuint _height)
function to add a depth renderbuffer to the fbo
Definition: FBO.cc:343
QString renderObjectsInfo(bool _outputShaderInfo)
Return a qstring of the current render objects.
GLSL program class.
Definition: GLSLShader.hh:217
int viewport_height() const
get viewport height
Definition: GLState.hh:827
GLSL::Program * progPoint_
point lighting pass
int getNumRenderObjects() const
Get the number of collected render objects (not including overlay objects or gl4.2 line objects) ...
Definition: IRenderer.cc:1179
GLSL::Program * progPointMS_
point lighting pass with multisampling
GLSL::Program * progSpotMS_
spot lighting pass with multisampling
virtual void prepareRenderingPipeline(ACG::GLState *_glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode *_scenegraphRoot)
Prepares renderer and OpenGL for any draw-related calls including.
Definition: IRenderer.cc:529
void addUniform(QString _uniform, QString _comment="")
Add one GLSL uniform specifier.
static QString getShaderDir()
void modifyVertexEndCode(QStringList *_code)
Append code the the vertex shader.
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
GLSL::Program * progDirectional_
directional lighting pass
int getFragDataLocation(const char *_name)
Get location of the fragment data output.
Definition: GLSLShader.cc:730
void use()
Enables the program object for using.
Definition: GLSLShader.cc:351
virtual void restoreInputFbo()
Restore the previously saved input Fbo configuration (fbo id + viewport)
Definition: IRenderer.cc:768
static unsigned int registerModifier(ShaderModifier *_modifier)
Shader modifiers have to be registered before they can be used. They also must remain allocated for t...
void resize(GLsizei _width, GLsizei _height, bool _forceResize=false)
resize function (if textures created by this class)
Definition: FBO.cc:543
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
Definition: GLSLShader.cc:1082
void disable()
Resets to standard rendering pipeline.
Definition: GLSLShader.cc:361
ACG::Vec4f backgroundColor()
Get current background color.