NGL  6.5
The NCCA Graphics Library
ShaderProgram.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 //----------------------------------------------------------------------------------------------------------------------
20 //----------------------------------------------------------------------------------------------------------------------
21 
22 #include "ShaderProgram.h"
23 #include "fmt/format.h"
24 
25 namespace ngl
26 {
27 //----------------------------------------------------------------------------------------------------------------------
29 {
30  // we create a special NULL program so the shader manager can return
31  // a NULL object.
32 if (_name !="NULL")
33  {
34  m_programID = glCreateProgram();
35  }
36  else
37  {
38  m_programID=0;
39  }
40  //std::cerr <<"Created program id is "<<m_programID<<"\n";
41  m_debugState=true;
42  m_programName=_name;
43  m_linked=false;
44  m_active=false;
45 }
47 {
48  std::cerr<<"removing ShaderProgram "<< m_programName<<"\n";
50 }
51 //----------------------------------------------------------------------------------------------------------------------
52 void ShaderProgram::use() noexcept
53 {
54  // std::cerr<<"Using shader "<<m_programName<<" id "<<m_programID<<"\n";
56  //NGLCheckGLError(__FILE__,__LINE__);
57  m_active=true;
58 }
59 
60 //----------------------------------------------------------------------------------------------------------------------
61 void ShaderProgram::unbind() noexcept
62 {
63  m_active=false;
64  glUseProgram(0);
65 }
66 
67 //----------------------------------------------------------------------------------------------------------------------
68 void ShaderProgram::attachShader(Shader *_shader) noexcept
69 {
70  m_shaders.push_back(_shader);
71  glAttachShader(m_programID,_shader->getShaderHandle());
72 }
73 
74 //----------------------------------------------------------------------------------------------------------------------
75 void ShaderProgram::bindAttribute(GLuint _index, const std::string &_attribName) noexcept
76 {
77  if(m_linked == true)
78  {
79  std::cerr<<"Warning binding attribute after link\n";
80  }
81  m_attribs[_attribName]=_index;
82  glBindAttribLocation(m_programID,_index,_attribName.c_str());
83  //std::cerr<<"bindAttribLoc "<<m_programID<<" index "<<_index<<" name "<<_attribName<<"\n";
84  NGLCheckGLError(__FILE__,__LINE__);
85 }
86 
87 void ShaderProgram::bindFragDataLocation(GLuint _index, const std::string &_attribName) noexcept
88 {
89  if(m_linked == true)
90  {
91  std::cerr<<"Warning binding attribute after link\n";
92  }
93  m_attribs[_attribName]=_index;
94  #ifndef USINGIOS_
95  glBindFragDataLocation(m_programID,_index,_attribName.c_str());
96  #endif
97  //std::cerr<<"bindAttribLoc "<<m_programID<<" index "<<_index<<" name "<<_attribName<<"\n";
98  NGLCheckGLError(__FILE__,__LINE__);
99 }
100 
101 //----------------------------------------------------------------------------------------------------------------------
102 void ShaderProgram::link() noexcept
103 {
105  if(m_debugState==true)
106  {
107  std::cerr <<"linking Shader "<< m_programName.c_str()<<"\n";
108  }
109  GLint infologLength = 0;
110 
112 
113  if(infologLength > 0)
114  {
115  char *infoLog = new char[infologLength];
116  GLint charsWritten = 0;
117 
118  glGetProgramInfoLog(m_programID, infologLength, &charsWritten, infoLog);
119 
120  std::cerr<<infoLog<<std::endl;
121  delete [] infoLog;
122  glGetProgramiv(m_programID, GL_LINK_STATUS,&infologLength);
123  if( infologLength == GL_FALSE)
124  {
125  std::cerr<<"Program link failed exiting \n";
126  exit(EXIT_FAILURE);
127  }
128  }
129 
130  m_linked=true;
133 
134 }
135 
136 
137 //----------------------------------------------------------------------------------------------------------------------
138 GLint ShaderProgram::getUniformLocation(const char* _name ) const noexcept
139 {
140  // nasty C lib uses -1 return value for error
141  GLint loc = glGetUniformLocation( m_programID ,_name);
142  if (loc == -1)
143  {
144  std::cerr<<"Uniform \""<<_name<<"\" not found in Program \""<<m_programName<<"\"\n";
145  }
146  // so we cast to correct value when returning!
147  return loc;
148 }
149 
150 void ShaderProgram::printProperties() const noexcept
151 {
153  std::cerr<<"_______________________________________________________________________________________________________________________\n";
155 }
156 
157 //----------------------------------------------------------------------------------------------------------------------
159 {
160 #ifndef USINGIOS_
161  if(m_active !=true)
162  {
163  std::cerr<<"calling printActiveUniforms on unbound shader program\n";
164  }
165  GLint nUniforms;
167  char name[256];
168  GLsizei l;
169  for (GLint i=0; i<nUniforms; ++i)
170  {
171  glGetActiveUniformName(m_programID, static_cast<GLuint>(i), 256, &l, name);
172  std::cerr << "Uniform: "<<name<<"\n";
173  }
174 #endif
175 
176 }
177 
179 {
180  GLint nAttribs;
181 
184  GLsizei l;
185  char name[256];
186  for (GLint i=0; i < nAttribs; ++i)
187  {
188  glGetActiveAttrib(m_programID, static_cast<GLuint>(i), 256, &l, &size, &type, name);
189  std::cerr << "Attribute"<<i<<":\""<<name<<"\" Size:"<<size<<" Type:";
190  switch(type)
191  {
192  case GL_FLOAT: std::cerr << "GL_FLOAT\n"; break;
193  case GL_FLOAT_VEC2: std::cerr << "GL_FLOAT_VEC2\n"; break;
194  case GL_FLOAT_VEC3: std::cerr << "GL_FLOAT_VEC3\n"; break;
195  case GL_FLOAT_VEC4: std::cerr << "GL_FLOAT_VEC4\n"; break;
196  case GL_FLOAT_MAT2: std::cerr << "GL_FLOAT_MAT2\n"; break;
197  case GL_FLOAT_MAT3: std::cerr << "GL_FLOAT_MAT3\n"; break;
198  case GL_FLOAT_MAT4: std::cerr << "GL_FLOAT_MAT4\n"; break;
199  case GL_FLOAT_MAT2x3: std::cerr << "GL_FLOAT_MAT2x3\n"; break;
200  case GL_FLOAT_MAT2x4: std::cerr << "GL_FLOAT_MAT2x4\n"; break;
201  case GL_FLOAT_MAT3x2: std::cerr << "GL_FLOAT_MAT3x2\n"; break;
202  case GL_FLOAT_MAT3x4: std::cerr << "GL_FLOAT_MAT3x4\n"; break;
203  case GL_FLOAT_MAT4x2: std::cerr << "GL_FLOAT_MAT4x2\n"; break;
204  case GL_FLOAT_MAT4x3: std::cerr << "GL_FLOAT_MAT4x3\n"; break;
205  default: std::cerr << "UNKNOWN\n";
206  }
207  }
208 }
209 
210 
211 //----------------------------------------------------------------------------------------------------------------------
212 void ShaderProgram::setUniform1f( const char* _varname, float _v0 ) const noexcept
213 {
214  glUniform1f(getUniformLocation(_varname),_v0);
215 }
216 
217 //----------------------------------------------------------------------------------------------------------------------
218 void ShaderProgram::setRegisteredUniform1f( const std::string &_varname, float _v0 ) const noexcept
219 {
220  auto uniform=m_registeredUniforms.find(_varname);
221  // make sure we have a valid shader
222  if(uniform!=m_registeredUniforms.end())
223  {
224  glUniform1f(uniform->second.loc,_v0);
225  }
226 
227 }
228 //----------------------------------------------------------------------------------------------------------------------
229 void ShaderProgram::setUniform2f(const char* _varname, float _v0, float _v1 ) const noexcept
230 {
231  glUniform2f(getUniformLocation(_varname),_v0,_v1);
232 }
233 
234 
235 //----------------------------------------------------------------------------------------------------------------------
236 void ShaderProgram::setRegisteredUniform2f(const std::string &_varname, float _v0, float _v1 ) const noexcept
237 {
238  auto uniform=m_registeredUniforms.find(_varname);
239  // make sure we have a valid shader
240  if(uniform!=m_registeredUniforms.end())
241  {
242  glUniform2f(uniform->second.loc,_v0,_v1);
243  }
244 
245 }
246 
247 //----------------------------------------------------------------------------------------------------------------------
248 void ShaderProgram::setUniform3f(const char* _varname, float _v0, float _v1, float _v2 ) const noexcept
249 {
250  glUniform3f(getUniformLocation(_varname),_v0,_v1,_v2);
251 }
252 //----------------------------------------------------------------------------------------------------------------------
253 void ShaderProgram::setRegisteredUniform3f( const std::string &_varname, float _v0, float _v1, float _v2 ) const noexcept
254 {
255  auto uniform=m_registeredUniforms.find(_varname);
256  // make sure we have a valid shader
257  if(uniform!=m_registeredUniforms.end())
258  {
259  glUniform3f(uniform->second.loc,_v0,_v1,_v2);
260  }
261 
262 }
263 //----------------------------------------------------------------------------------------------------------------------
264 void ShaderProgram::setUniform4f( const char* _varname, float _v0,float _v1, float _v2, float _v3 ) const noexcept
265 {
266 
267  glUniform4f(getUniformLocation(_varname),_v0,_v1,_v2,_v3);
268 }
269 //----------------------------------------------------------------------------------------------------------------------
270 void ShaderProgram::setRegisteredUniform4f( const std::string &_varname, float _v0, float _v1, float _v2, float _v3 ) const noexcept
271 {
272  auto uniform=m_registeredUniforms.find(_varname);
273  // make sure we have a valid shader
274  if(uniform!=m_registeredUniforms.end())
275  {
276  glUniform4f(uniform->second.loc,_v0,_v1,_v2,_v3);
277  }
278 
279 }
280 
281 //----------------------------------------------------------------------------------------------------------------------
282 void ShaderProgram::setUniform1fv(const char* _varname, size_t _count, const float* _value ) const noexcept
283 {
284  glUniform1fv(getUniformLocation(_varname),_count,_value);
285 }
286 
287 //----------------------------------------------------------------------------------------------------------------------
288 void ShaderProgram::setUniform2fv(const char* _varname, size_t _count, const float* _value ) const noexcept
289 {
290  glUniform2fv(getUniformLocation(_varname),_count,_value);
291 }
292 
293 //----------------------------------------------------------------------------------------------------------------------
294 void ShaderProgram::setUniform3fv( const char* _varname, size_t _count, const float* _value ) const noexcept
295 {
296  glUniform3fv(getUniformLocation(_varname),_count,_value);
297 }
298 
299 //----------------------------------------------------------------------------------------------------------------------
300 void ShaderProgram::setUniform4fv(const char* _varname,size_t _count, const float* _value ) const noexcept
301 {
302  glUniform4fv(getUniformLocation(_varname),_count,_value);
303 
304 }
305 
306 
307 //----------------------------------------------------------------------------------------------------------------------
308 void ShaderProgram::setUniform1i( const char* _varname, GLint _v0 ) const noexcept
309 {
310  glUniform1i(getUniformLocation(_varname),_v0);
311 
312 }
313 
314 //----------------------------------------------------------------------------------------------------------------------
315 void ShaderProgram::setRegisteredUniform1i( const std::string &_varname, int _v0 ) const noexcept
316 {
317  auto uniform=m_registeredUniforms.find(_varname);
318  // make sure we have a valid shader
319  if(uniform!=m_registeredUniforms.end())
320  {
321  glUniform1i(uniform->second.loc,_v0);
322  }
323 
324 }
325 
326 //----------------------------------------------------------------------------------------------------------------------
327 void ShaderProgram::setRegisteredUniform2i( const std::string &_varname, int _v0, int _v1 ) const noexcept
328 {
329  auto uniform=m_registeredUniforms.find(_varname);
330  // make sure we have a valid shader
331  if(uniform!=m_registeredUniforms.end())
332  {
333  glUniform2i(uniform->second.loc,_v0,_v1);
334  }
335 
336 }
337 
338 
339 //----------------------------------------------------------------------------------------------------------------------
340 void ShaderProgram::setRegisteredUniform3i(const std::string &_varname, int _v0, int _v1, int _v2 ) const noexcept
341 {
342  auto uniform=m_registeredUniforms.find(_varname);
343  // make sure we have a valid shader
344  if(uniform!=m_registeredUniforms.end())
345  {
346  glUniform3i(uniform->second.loc,_v0,_v1,_v2);
347  }
348 }
349 
350 //----------------------------------------------------------------------------------------------------------------------
351 void ShaderProgram::setRegisteredUniform4i( const std::string &_varname, int _v0, int _v1, int _v2, int _v3 ) const noexcept
352 {
353  auto uniform=m_registeredUniforms.find(_varname);
354  // make sure we have a valid shader
355  if(uniform!=m_registeredUniforms.end())
356  {
357  glUniform4i(uniform->second.loc,_v0,_v1,_v2,_v3);
358  }
359 
360 }
361 //----------------------------------------------------------------------------------------------------------------------
362 void ShaderProgram::setUniform2i( const char* _varname, GLint _v0, GLint _v1 ) const noexcept
363 {
364  glUniform2i(getUniformLocation(_varname),_v0,_v1);
365 
366 }
367 //----------------------------------------------------------------------------------------------------------------------
368 void ShaderProgram::setUniform3i( const char* _varname, GLint _v0, GLint _v1, GLint _v2 ) const noexcept
369 {
370  glUniform3i(getUniformLocation(_varname),_v0,_v1,_v2);
371 
372 }
373 //----------------------------------------------------------------------------------------------------------------------
374 void ShaderProgram::setUniform4i( const char* _varname, GLint _v0,GLint _v1, GLint _v2, GLint _v3 ) const noexcept
375 {
376  glUniform4i(getUniformLocation(_varname),_v0,_v1,_v2,_v3);
377 
378 }
379 //----------------------------------------------------------------------------------------------------------------------
380 void ShaderProgram::setUniform1iv( const char* _varname, size_t _count, const GLint* _value ) const noexcept
381 {
382  glUniform1iv(getUniformLocation(_varname),_count,_value);
383 
384 }
385 //----------------------------------------------------------------------------------------------------------------------
386 void ShaderProgram::setUniform2iv( const char* _varname, size_t _count, const GLint* _value ) const noexcept
387 {
388  glUniform2iv(getUniformLocation(_varname),_count,_value);
389 }
390 //----------------------------------------------------------------------------------------------------------------------
391 void ShaderProgram::setUniform3iv( const char* _varname,size_t _count, const GLint* _value ) const noexcept
392 {
393  glUniform3iv(getUniformLocation(_varname),_count,_value);
394 
395 }
396 //----------------------------------------------------------------------------------------------------------------------
397 void ShaderProgram::setUniform4iv(const char* _varname, size_t _count,const GLint* _value ) const noexcept
398 {
399  glUniform4iv(getUniformLocation(_varname),_count,_value);
400 }
401 
402 
403 //----------------------------------------------------------------------------------------------------------------------
404 void ShaderProgram::setUniformMatrix2fv(const char* _varname,size_t _count, bool _transpose,const float* _value ) const noexcept
405 {
406  glUniformMatrix2fv(getUniformLocation(_varname),_count,_transpose,_value);
407 }
408 
409 //----------------------------------------------------------------------------------------------------------------------
410 void ShaderProgram::setUniformMatrix3fv( const char* _varname, size_t _count,bool _transpose, const float* _value ) const noexcept
411 {
412  glUniformMatrix3fv(getUniformLocation(_varname),_count,_transpose,_value);
413 
414 }
415 
416 
417 //----------------------------------------------------------------------------------------------------------------------
418 void ShaderProgram::setRegisteredUniformMatrix3fv( const std::string &_varname,size_t _count, bool _transpose,const float* _value) const noexcept
419 {
420  auto uniform=m_registeredUniforms.find(_varname);
421  // make sure we have a valid shader
422  if(uniform!=m_registeredUniforms.end())
423  {
424  glUniformMatrix3fv(uniform->second.loc,_count,_transpose,_value);
425  }
426 
427 }
428 //----------------------------------------------------------------------------------------------------------------------
429 void ShaderProgram::setUniformMatrix4fv(const char* _varname, size_t _count, bool _transpose, const float* _value ) const noexcept
430 {
431  glUniformMatrix4fv(getUniformLocation(_varname),_count,_transpose,_value);
432 }
433 
434 
435 //----------------------------------------------------------------------------------------------------------------------
436 void ShaderProgram::setRegisteredUniformMatrix4fv(const std::string &_varname, size_t _count, bool _transpose, const float* _value ) const noexcept
437 {
438  auto uniform=m_registeredUniforms.find(_varname);
439  // make sure we have a valid shader
440  if(uniform!=m_registeredUniforms.end())
441  {
442  glUniformMatrix4fv(uniform->second.loc,_count,_transpose,_value);
443  }
444 
445 }
446 //----------------------------------------------------------------------------------------------------------------------
447 
448 
449 
450 //----------------------------------------------------------------------------------------------------------------------
451 void ShaderProgram::setUniformMatrix2x3fv(const char* _varname,size_t _count,bool _transpose, const float* _value ) const noexcept
452 {
453  glUniformMatrix2x3fv(getUniformLocation(_varname),_count,_transpose,_value);
454 }
455 
456 //----------------------------------------------------------------------------------------------------------------------
457 void ShaderProgram::setUniformMatrix2x4fv(const char* _varname, size_t _count,bool _transpose,const float* _value) const noexcept
458 {
459  glUniformMatrix2x4fv(getUniformLocation(_varname),_count,_transpose,_value);
460 
461 }
462 //----------------------------------------------------------------------------------------------------------------------
463 void ShaderProgram::setUniformMatrix3x2fv(const char* _varname,size_t _count,bool _transpose,const float* _value ) const noexcept
464 {
465  glUniformMatrix3x2fv(getUniformLocation(_varname),_count,_transpose,_value);
466 
467 }
468 
469 //----------------------------------------------------------------------------------------------------------------------
470 void ShaderProgram::setUniformMatrix3x4fv(const char* _varname,size_t _count,bool _transpose, const float* _value) const noexcept
471 {
472  glUniformMatrix3x4fv(getUniformLocation(_varname),_count,_transpose,_value);
473 
474 }
475 //----------------------------------------------------------------------------------------------------------------------
476 void ShaderProgram::setUniformMatrix4x2fv(const char* _varname,size_t _count,bool _transpose,const float* _value ) const noexcept
477 {
478  glUniformMatrix4x2fv(getUniformLocation(_varname),_count,_transpose,_value);
479 
480 }
481 
482 //----------------------------------------------------------------------------------------------------------------------
483 void ShaderProgram::setUniformMatrix4x3fv(const char* _varname,size_t _count,bool _transpose,const float* _value) const noexcept
484 {
485  glUniformMatrix4x3fv(getUniformLocation(_varname),_count,_transpose,_value);
486 
487 }
488 
489 //----------------------------------------------------------------------------------------------------------------------
490 void ShaderProgram::getUniformfv( const char* _varname,float* o_values ) const noexcept
491 {
492  glGetUniformfv(m_programID, getUniformLocation(_varname),o_values);
493 }
494 
495 //----------------------------------------------------------------------------------------------------------------------
496 void ShaderProgram::getUniformiv(const char* _varname,int *o_values ) const noexcept
497 {
498  glGetUniformiv(m_programID,getUniformLocation(_varname),o_values);
499 }
500 
501 
502 //----------------------------------------------------------------------------------------------------------------------
503 void ShaderProgram::enableAttribArray( const char* _name) const noexcept
504 {
505 
506  auto index=m_attribs.find(_name);
507 
508 
509  if(index!=m_attribs.end())
510  {
511  std::cerr<<"Enable attrib "<<index->second<<"\n";
512  glEnableVertexAttribArray( index->second );
513  }
514 }
515 
516 //----------------------------------------------------------------------------------------------------------------------
517 void ShaderProgram::disableAttribArray(const char* _name) const noexcept
518 {
520 
521 }
522 
523 
524 
525 void ShaderProgram::bindFragDataLocation(GLuint _colourNumber, const char *_name) noexcept
526 {
527  #ifndef USINGIOS_
528  glBindFragDataLocation(m_programID , _colourNumber, _name);
529  #endif
530 }
531 
532 GLuint ShaderProgram::getUniformBlockIndex( const std::string &_uniformBlockName )const noexcept
533 {
534  return glGetUniformBlockIndex(m_programID,_uniformBlockName.c_str());
535 }
536 
537 
539 {
540 
541 
542  GLint nUniforms;
544  // could use this with better OpenGL version
545  // glGetProgramInterfaceiv(i, GL_UNIFORM, GL_ACTIVE_RESOURCES, &numUniforms);
546 
547  char name[256];
549  for (GLint i=0; i<nUniforms; ++i)
550  {
551  GLenum type = GL_ZERO;
552  GLsizei nameLen=0;
553  GLint num=0;
554  glGetActiveUniform( m_programID, i, sizeof(name)-1, &nameLen, &num, &type, name );
555  // two options we either have an array or single value
556  // if not array
557  if(num == 1)
558  {
559  data.name=name;
561  data.type=type;
563  }
564  else
565  {
566  std::string uniform(name);
567  std::string baseName=uniform.substr(0, uniform.find("["));
568  // nvidia returns uniform[0], ATI uniform, best way is to split on [
569  for(int i=0; i<num; ++i)
570  {
571  std::string name=fmt::format("{0}[{1}]", baseName , i) ;
572 
573  data.name=name;
574  data.loc=glGetUniformLocation(m_programID,name.c_str());
575  data.type=type;
577  }
578  }
579  }
580 }
581 
583 {
584  const static std::unordered_map<GLenum,const char *> types=
585  {
586  {GL_FLOAT,"float"},
587  {GL_FLOAT_VEC2,"vec2"},
588  {GL_FLOAT_VEC3,"vec3"},
589  {GL_FLOAT_VEC4,"vec4"},
590  #ifndef USINGIOS_
591  {GL_DOUBLE,"double"},
592  {GL_DOUBLE_VEC2,"dvec2"},
593  {GL_DOUBLE_VEC3,"dvec3"},
594  {GL_DOUBLE_VEC4,"dvec4"},
595  #endif
596  {GL_INT,"int"},
597  {GL_INT_VEC2,"ivec2"},
598  {GL_INT_VEC3,"ivec3"},
599  {GL_INT_VEC4,"ivec4"},
600  {GL_UNSIGNED_INT,"unsigned int"},
601  {GL_UNSIGNED_INT_VEC2,"uvec2"},
602  {GL_UNSIGNED_INT_VEC3,"uvec3"},
603  {GL_UNSIGNED_INT_VEC4,"uvec4"},
604  {GL_BOOL,"bool"},
605  {GL_BOOL_VEC2,"bvec2"},
606  {GL_BOOL_VEC3,"bvec3"},
607  {GL_BOOL_VEC4,"bvec4"},
608  {GL_FLOAT_MAT2,"mat2"},
609  {GL_FLOAT_MAT3,"mat3"},
610  {GL_FLOAT_MAT4,"mat4"},
611  {GL_FLOAT_MAT2x3,"mat2x3"},
612  {GL_FLOAT_MAT2x4,"mat2x4"},
613  {GL_FLOAT_MAT3x2,"mat3x2"},
614  {GL_FLOAT_MAT3x4,"mat3x4"},
615  {GL_FLOAT_MAT4x2,"mat4x2"},
616  {GL_FLOAT_MAT4x3,"mat4x3"},
617  #ifndef USINGIOS_
618  {GL_DOUBLE_MAT2,"dmat2"},
619  {GL_DOUBLE_MAT3,"dmat3"},
620  {GL_DOUBLE_MAT4,"dmat4"},
621  {GL_DOUBLE_MAT2x3,"dmat2x3"},
622  {GL_DOUBLE_MAT2x4,"dmat2x4"},
623  {GL_DOUBLE_MAT3x2,"dmat3x2"},
624  {GL_DOUBLE_MAT3x4,"dmat3x4"},
625  {GL_DOUBLE_MAT4x2,"dmat4x2"},
626  {GL_DOUBLE_MAT4x3,"dmat4x3"},
627  {GL_SAMPLER_1D,"sampler1D"},
628  {GL_SAMPLER_1D_SHADOW,"sampler1DShadow"},
629  {GL_SAMPLER_1D_ARRAY,"sampler1DArray"},
630  {GL_SAMPLER_1D_ARRAY_SHADOW,"sampler1DArrayShadow"},
631  {GL_SAMPLER_2D_MULTISAMPLE,"sampler2DMS"},
632  {GL_SAMPLER_2D_MULTISAMPLE_ARRAY,"sampler2DMSArray"},
633  {GL_SAMPLER_BUFFER,"samplerBuffer"},
634  {GL_SAMPLER_2D_RECT,"sampler2DRect"},
635  {GL_SAMPLER_2D_RECT_SHADOW,"sampler2DRectShadow"},
636  {GL_INT_SAMPLER_1D,"isampler1D"},
637  {GL_INT_SAMPLER_1D_ARRAY,"isampler1DArray"},
638  {GL_INT_SAMPLER_2D_MULTISAMPLE,"isampler2DMS"},
639  {GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,"isampler2DMSArray"},
640  {GL_INT_SAMPLER_BUFFER,"isamplerBuffer"},
641  {GL_INT_SAMPLER_2D_RECT,"isampler2DRect"},
642  {GL_UNSIGNED_INT_SAMPLER_1D,"usampler1D"},
643  {GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,"usampler2DArray"},
645  {GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,"usampler2DMSArray"},
646  {GL_UNSIGNED_INT_SAMPLER_BUFFER,"usamplerBuffer"},
647  {GL_UNSIGNED_INT_SAMPLER_2D_RECT,"usampler2DRect"},
648  {GL_IMAGE_1D,"image1D"},
649  {GL_IMAGE_2D,"image2D"},
650  {GL_IMAGE_3D,"image3D"},
651  {GL_IMAGE_2D_RECT,"image2DRect"},
652  {GL_IMAGE_CUBE,"imageCube"},
653  {GL_IMAGE_BUFFER,"imageBuffer"},
654  {GL_IMAGE_1D_ARRAY,"image1DArray"},
655  {GL_IMAGE_2D_ARRAY,"image2DArray"},
656  {GL_IMAGE_2D_MULTISAMPLE,"image2DMS"},
657  {GL_IMAGE_2D_MULTISAMPLE_ARRAY,"image2DMSArray"},
658  {GL_INT_IMAGE_1D,"iimage1D"},
659  {GL_INT_IMAGE_2D,"iimage2D"},
660  {GL_INT_IMAGE_3D,"iimage3D"},
661  {GL_INT_IMAGE_2D_RECT,"iimage2DRect"},
662  {GL_INT_IMAGE_CUBE,"iimageCube"},
663  {GL_INT_IMAGE_BUFFER,"iimageBuffer"},
664  {GL_INT_IMAGE_1D_ARRAY,"iimage1DArray"},
665  {GL_INT_IMAGE_2D_ARRAY,"iimage2DArray"},
666  {GL_INT_IMAGE_2D_MULTISAMPLE,"iimage2DMS"},
667  {GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY,"iimage2DMSArray"},
668  {GL_UNSIGNED_INT_IMAGE_1D,"uimage1D"},
669  {GL_UNSIGNED_INT_IMAGE_2D,"uimage2D"},
670  {GL_UNSIGNED_INT_IMAGE_3D,"uimage3D"},
671  {GL_UNSIGNED_INT_IMAGE_2D_RECT,"uimage2DRect"},
672  {GL_UNSIGNED_INT_IMAGE_CUBE,"uimageCube"},
673  {GL_UNSIGNED_INT_IMAGE_BUFFER,"uimageBuffer"},
674  {GL_UNSIGNED_INT_IMAGE_1D_ARRAY,"uimage1DArray"},
675  {GL_UNSIGNED_INT_IMAGE_2D_ARRAY,"uimage2DArray"},
677  {GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY,"uimage2DMSArray"},
678  {GL_UNSIGNED_INT_ATOMIC_COUNTER,"atomic_uint"},
679 
680  #endif
681  {GL_SAMPLER_2D,"sampler2D"},
682  {GL_SAMPLER_3D,"sampler3D"},
683  {GL_SAMPLER_CUBE,"samplerCube"},
684  {GL_SAMPLER_2D_SHADOW,"sampler2DShadow"},
685  {GL_SAMPLER_2D_ARRAY,"sampler2DArray"},
686  {GL_SAMPLER_2D_ARRAY_SHADOW,"sampler2DArrayShadow"},
687  {GL_SAMPLER_CUBE_SHADOW,"samplerCubeShadow"},
688  {GL_INT_SAMPLER_2D,"isampler2D"},
689  {GL_INT_SAMPLER_3D,"isampler3D"},
690  {GL_INT_SAMPLER_CUBE,"isamplerCube"},
691  {GL_INT_SAMPLER_2D_ARRAY,"isampler2DArray"},
692  {GL_UNSIGNED_INT_SAMPLER_2D,"usampler2D"},
693  {GL_UNSIGNED_INT_SAMPLER_3D,"usampler3D"},
694  {GL_UNSIGNED_INT_SAMPLER_CUBE,"usamplerCube"},
695  {GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,"usampler2DArray"}
696  };
697  std::cout<<"Registered Uniforms for shader "<< m_programName<<"\n";
698  for(auto d : m_registeredUniforms)
699  {
701  auto value=types.find(d.second.type);
702  if(value !=types.end())
703  {
704  type=value->second;
705  }
706  else
707  {
708  type="unknown type";
709  }
710  std::cout<<"Uniform "<<d.first<<"-> "<<" location "<<d.second.loc<<" glsl type "<<type<<"\n";
711 
712  }
713 }
714 
715 
716 } // end ngl namespace
#define GL_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: glew.h:6166
#define glCreateProgram
Definition: glew.h:1914
#define GL_INT_VEC3
Definition: glew.h:1780
unsigned int GLuint
Definition: glew.h:280
#define glGetActiveUniformName
Definition: glew.h:7411
#define GL_IMAGE_BUFFER
Definition: glew.h:6161
void setRegisteredUniform1f(const std::string &_varname, float _v0) const noexcept
sets the registered uniform to a single float
#define glUniform2iv
Definition: glew.h:1952
#define GL_DOUBLE_VEC3
Definition: glew.h:4725
#define GL_SAMPLER_2D
Definition: glew.h:1790
void setUniform2i(const char *_varname, GLint _v0, GLint _v1) const noexcept
sets &#39;_varname&#39; as a int2
#define GL_FLOAT_MAT3x2
Definition: glew.h:2020
#define GL_DOUBLE_MAT2x4
Definition: glew.h:4719
#define glGetUniformiv
Definition: glew.h:1933
#define GL_FLOAT_MAT3x4
Definition: glew.h:2021
#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY
Definition: glew.h:2159
void setUniform2f(const char *_varname, float _v0, float _v1) const noexcept
sets &#39;_varname&#39; as a float2
void setUniformMatrix3x4fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 3x4 matrix array
void setUniformMatrix3fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 3D matrix array
void setUniform3f(const char *_varname, float _v0, float _v1, float _v2) const noexcept
sets &#39;_varname&#39; as a float3
#define GL_ZERO
Definition: glew.h:313
std::vector< Shader * > m_shaders
a list of the shader objects attached to the program
#define GL_UNSIGNED_INT_SAMPLER_BUFFER
Definition: glew.h:2302
GLuint m_programID
the program id for this program object
#define glEnableVertexAttribArray
Definition: glew.h:1921
#define glUniformMatrix2x4fv
Definition: glew.h:2045
#define GL_FLOAT_MAT4
Definition: glew.h:1788
bool m_active
indicate if this program is the current active program
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1256
#define glUniform4iv
Definition: glew.h:1960
#define GL_SAMPLER_1D_ARRAY_SHADOW
Definition: glew.h:2143
#define GL_SAMPLER_1D_SHADOW
Definition: glew.h:1793
#define GL_SAMPLER_1D
Definition: glew.h:1789
#define GL_UNSIGNED_INT_IMAGE_3D
Definition: glew.h:6180
#define glUniformMatrix4x2fv
Definition: glew.h:2048
#define glUniformMatrix3x4fv
Definition: glew.h:2047
#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: glew.h:7035
void setRegisteredUniform3i(const std::string &_varname, int _v0, int _v1, int _v2) const noexcept
sets the registered uniform to a single int
#define glUniform1i
Definition: glew.h:1947
void setRegisteredUniform4f(const std::string &_varname, float _v0, float _v1, float _v2, float _v3) const noexcept
sets the registered uniform to a single float
#define glUniform2fv
Definition: glew.h:1950
#define GL_FALSE
Definition: glew.h:314
#define GL_UNSIGNED_INT_IMAGE_2D_RECT
Definition: glew.h:6181
#define glUniformMatrix2x3fv
Definition: glew.h:2044
std::string format(CStringRef format_str, ArgList args)
Definition: format.h:3175
#define GL_FLOAT_MAT2x4
Definition: glew.h:2019
#define GL_INT_IMAGE_1D_ARRAY
Definition: glew.h:6173
#define glUniformMatrix2fv
Definition: glew.h:1961
#define GL_INT_IMAGE_2D_MULTISAMPLE
Definition: glew.h:6176
#define glUniformMatrix4x3fv
Definition: glew.h:2049
void attachShader(Shader *_shader) noexcept
attach a shader to the ProgramObject
#define GL_ACTIVE_UNIFORMS
Definition: glew.h:1801
#define GL_INT_IMAGE_BUFFER
Definition: glew.h:6172
GLsizei const GLfloat * value
Definition: glew.h:1852
void setUniform3i(const char *_varname, GLint _v0, GLint _v1, GLint _v2) const noexcept
sets &#39;_varname&#39; as a int3
#define glGetActiveAttrib
Definition: glew.h:1922
#define GL_SAMPLER_2D_RECT
Definition: glew.h:2291
#define GL_FLOAT_MAT2x3
Definition: glew.h:2018
#define GL_UNSIGNED_INT_IMAGE_BUFFER
Definition: glew.h:6183
this structure holds information about the registered uniforms in the program id is the uniform locat...
#define GL_INT_IMAGE_1D
Definition: glew.h:6167
void printActiveAttributes() const noexcept
lists the available Attributes for the shader (this was a pain because the compiler quietly gets rid ...
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1382
GLsizei GLsizei GLchar * infoLog
Definition: glew.h:1832
#define GL_INT_IMAGE_2D_ARRAY
Definition: glew.h:6174
#define GL_UNSIGNED_INT_SAMPLER_CUBE
Definition: glew.h:2158
#define GL_IMAGE_CUBE
Definition: glew.h:6160
unsigned int GLenum
Definition: glew.h:278
implementation files for RibExport class
Definition: AABB.cpp:22
std::string m_programName
text name of the current program used in lookup and debugging
GLdouble l
Definition: glew.h:9162
bool m_debugState
debug mode flag
#define GL_FLOAT_MAT3
Definition: glew.h:1787
#define glUniformMatrix3x2fv
Definition: glew.h:2046
#define GL_INT_VEC4
Definition: glew.h:1781
void enableAttribArray(const char *_name) const noexcept
enables the specified varying array
#define GL_BOOL_VEC4
Definition: glew.h:1785
#define GL_INT_SAMPLER_1D
Definition: glew.h:2149
void disableAttribArray(const char *_name) const noexcept
disables the specified varying array
#define GL_INT_SAMPLER_2D_MULTISAMPLE
Definition: glew.h:7033
#define glBindFragDataLocation
Definition: glew.h:2224
#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY
Definition: glew.h:6185
void unbind() noexcept
method to unbind the current Program Object this will set the shader to be the glUseProgram(0) defaul...
#define glGetUniformLocation
Definition: glew.h:1931
#define GL_DOUBLE_MAT4x3
Definition: glew.h:4723
#define GL_UNSIGNED_INT_ATOMIC_COUNTER
Definition: glew.h:6076
void setRegisteredUniform2f(const std::string &_varname, float _v0, float _v1) const noexcept
sets the registered uniform to a single float
#define GL_SAMPLER_2D_MULTISAMPLE
Definition: glew.h:7032
#define GL_DOUBLE_MAT3x4
Definition: glew.h:4721
void getUniformfv(const char *_name, float *o_values) const noexcept
gets the current value of the specified uniform var
#define glUniform1fv
Definition: glew.h:1946
#define GL_INT_SAMPLER_2D
Definition: glew.h:2150
#define GL_FLOAT_MAT2
Definition: glew.h:1786
ShaderProgram(std::string _name) noexcept
create an OpenGL shader program it is initially empty and just has a name for id
bool m_linked
flag to indicate if the current Program has been linked
#define GL_IMAGE_2D_RECT
Definition: glew.h:6159
void setUniformMatrix3x2fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 3x2 matrix array
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE
Definition: glew.h:6187
std::unordered_map< std::string, GLuint > m_attribs
a list of attributes for this object, mapping name to ID number
void setRegisteredUniformMatrix4fv(const std::string &_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 4D matrix array
#define glUniform3i
Definition: glew.h:1955
void link() noexcept
link our program object with the attatched shaders if shader are not attached the program will report...
#define glUniform2i
Definition: glew.h:1951
#define GL_SAMPLER_CUBE
Definition: glew.h:1792
#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: glew.h:6188
#define GL_UNSIGNED_INT_VEC4
Definition: glew.h:2148
#define glGetActiveUniform
Definition: glew.h:1923
void setRegisteredUniform4i(const std::string &_varname, int _v0, int _v1, int _v2, int _v3) const noexcept
sets the registered uniform to a single int
#define GL_INT_IMAGE_CUBE
Definition: glew.h:6171
void autoRegisterUniforms() noexcept
scan the shader source and find any uniforms and register them
GLuint num
Definition: glew.h:2693
#define glUniform3fv
Definition: glew.h:1954
#define glLinkProgram
Definition: glew.h:1940
#define glGetProgramiv
Definition: glew.h:1927
#define glGetUniformBlockIndex
Definition: glew.h:7414
#define GL_INT_IMAGE_3D
Definition: glew.h:6169
void setUniform4iv(const char *_varname, size_t _count, const GLint *_value) const noexcept
sets &#39;_varname&#39; as a 4D int array
#define GL_IMAGE_2D
Definition: glew.h:6157
#define GL_DOUBLE_MAT4
Definition: glew.h:4717
#define GL_FLOAT_MAT4x2
Definition: glew.h:2022
#define GL_LINK_STATUS
Definition: glew.h:1797
#define GL_SAMPLER_CUBE_SHADOW
Definition: glew.h:2145
void setRegisteredUniform3f(const std::string &_varname, float _v0, float _v1, float _v2) const noexcept
sets the registered uniform to a single float
#define GL_DOUBLE_MAT4x2
Definition: glew.h:4722
void printRegisteredUniforms() const noexcept
debug print the registered uniforms
void setUniform1fv(const char *_varname, size_t _count, const float *_value) const noexcept
sets &#39;_varname&#39; as a 1D float array
#define GL_SAMPLER_2D_ARRAY
Definition: glew.h:2142
#define GL_DOUBLE_MAT2x3
Definition: glew.h:4718
void bindFragDataLocation(GLuint index, const std::string &_attribName) noexcept
bind fragment output location in the Program object to _index using attribname
void setUniform4f(const char *_varname, float _v0, float _v1, float _v2, float _v3) const noexcept
sets &#39;_varname&#39; as a float4
void setUniform4i(const char *_varname, GLint _v0, GLint _v1, GLint _v2, GLint _v3) const noexcept
sets &#39;_varname&#39; as a float4
#define glUniform1f
Definition: glew.h:1945
void setUniformMatrix2x4fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 2x4 matrix array
#define glUniform1iv
Definition: glew.h:1948
#define GL_UNSIGNED_INT
Definition: glew.h:641
#define GL_IMAGE_2D_MULTISAMPLE
Definition: glew.h:6165
void setRegisteredUniform1i(const std::string &_varname, int _v0) const noexcept
sets the registered uniform to a single int
#define GL_INT_SAMPLER_2D_RECT
Definition: glew.h:2299
#define GL_IMAGE_1D
Definition: glew.h:6156
#define GL_DOUBLE_VEC4
Definition: glew.h:4726
#define glGetUniformfv
Definition: glew.h:1932
GLsizei GLenum GLenum * types
Definition: glew.h:3966
#define glUniformMatrix4fv
Definition: glew.h:1963
#define GL_INT_SAMPLER_2D_ARRAY
Definition: glew.h:2154
#define glAttachShader
Definition: glew.h:1910
#define GL_UNSIGNED_INT_VEC2
Definition: glew.h:2146
#define GL_DOUBLE_VEC2
Definition: glew.h:4724
#define glUniform3f
Definition: glew.h:1953
GLuint index
Definition: glew.h:1817
#define glUniform4f
Definition: glew.h:1957
#define GL_INT_SAMPLER_BUFFER
Definition: glew.h:2300
void setUniform2iv(const char *_varname, size_t _count, const GLint *_value) const noexcept
sets &#39;_varname&#39; as a 2D int array
#define GL_IMAGE_2D_ARRAY
Definition: glew.h:6163
#define glUniformMatrix3fv
Definition: glew.h:1962
void use() noexcept
use this Shader object as the current Active shader once this is set it is active until unbind us cal...
and encapsulation of an OpenGL Shader object with associations for source code, etc. Used in conjunction with the ShaderProgram class
Definition: Shader.h:40
#define glUniform3iv
Definition: glew.h:1956
void setUniform1i(const char *_varname, GLint _v0) const noexcept
#define GL_INT_SAMPLER_1D_ARRAY
Definition: glew.h:2153
#define GL_UNSIGNED_INT_IMAGE_2D
Definition: glew.h:6179
#define glUniform4fv
Definition: glew.h:1958
void setUniformMatrix4fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 4D matrix array
#define GL_IMAGE_3D
Definition: glew.h:6158
void setUniform4fv(const char *_varname, size_t _count, const float *_value) const noexcept
sets &#39;_varname&#39; as a 4D float array
void setUniformMatrix2x3fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 2x3 matrix array
void setUniform3fv(const char *_varname, size_t _count, const float *_value) const noexcept
sets &#39;_varname&#39; as a 3D float array
#define GL_BOOL_VEC2
Definition: glew.h:1783
#define GL_INT
Definition: glew.h:640
#define GL_FLOAT_MAT4x3
Definition: glew.h:2023
#define GL_INT_IMAGE_2D
Definition: glew.h:6168
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: glew.h:7037
GLuint const GLchar * name
Definition: glew.h:1817
#define GL_SAMPLER_BUFFER
Definition: glew.h:2298
#define GL_IMAGE_1D_ARRAY
Definition: glew.h:6162
#define GL_ACTIVE_ATTRIBUTES
Definition: glew.h:1804
GLsizeiptr size
Definition: glew.h:1684
void setUniform1iv(const char *_varname, size_t _count, const GLint *_value) const noexcept
sets &#39;_varname&#39; as a 1D int array
#define GL_UNSIGNED_INT_SAMPLER_2D
Definition: glew.h:2156
GLuint getUniformBlockIndex(const std::string &_uniformBlockName) const noexcept
get the index of a uniform bloc
#define GL_UNSIGNED_INT_SAMPLER_2D_RECT
Definition: glew.h:2301
#define GL_DOUBLE
Definition: glew.h:646
void setRegisteredUniform2i(const std::string &_varname, int _v0, int _v1) const noexcept
sets the registered uniform to a single int
#define GL_INT_SAMPLER_3D
Definition: glew.h:2151
void setUniformMatrix2fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 2D matrix array
#define GL_UNSIGNED_INT_VEC3
Definition: glew.h:2147
#define GL_UNSIGNED_INT_IMAGE_CUBE
Definition: glew.h:6182
#define GL_DOUBLE_MAT3x2
Definition: glew.h:4720
#define GL_FLOAT
Definition: glew.h:642
#define glUseProgram
Definition: glew.h:1964
void setUniformMatrix4x3fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 4x3 matrix array
void printActiveUniforms() const noexcept
lists the available uniforms for the shader (this was a pain because the compiler quietly gets rid of...
#define glBindAttribLocation
Definition: glew.h:1911
#define GL_DOUBLE_MAT3
Definition: glew.h:4716
int GLint
Definition: glew.h:281
#define glGetProgramInfoLog
Definition: glew.h:1926
#define GL_INT_VEC2
Definition: glew.h:1779
#define GL_SAMPLER_2D_ARRAY_SHADOW
Definition: glew.h:2144
#define GL_UNSIGNED_INT_IMAGE_1D
Definition: glew.h:6178
#define GL_INT_IMAGE_2D_RECT
Definition: glew.h:6170
#define GL_DOUBLE_MAT2
Definition: glew.h:4715
void getUniformiv(const char *_name, int *o_values) const noexcept
gets the current value of the specified uniform var
std::unordered_map< std::string, uniformData > m_registeredUniforms
a list of uniforms for this object, mapping name to ID number must be added by the user using the reg...
#define GL_INFO_LOG_LENGTH
Definition: glew.h:1799
#define glUniform2f
Definition: glew.h:1949
#define glDisableVertexAttribArray
Definition: glew.h:1919
#define GL_SAMPLER_3D
Definition: glew.h:1791
#define GL_BOOL
Definition: glew.h:1782
void setUniform2fv(const char *_varname, size_t _count, const float *_value) const noexcept
sets &#39;_varname&#39; as a 2D float array
#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
Definition: glew.h:7036
#define GL_UNSIGNED_INT_SAMPLER_1D
Definition: glew.h:2155
#define GL_INT_SAMPLER_CUBE
Definition: glew.h:2152
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
Definition: glew.h:7034
void printProperties() const noexcept
calls the printActiveUniforms followed by Attribs method written by Richard Southern.
void bindAttribute(GLuint index, const std::string &_attribName) noexcept
bind an attribute in the Program object to _index using attribname
#define GL_FLOAT_VEC3
Definition: glew.h:1777
#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY
Definition: glew.h:2160
#define GL_UNSIGNED_INT_SAMPLER_3D
Definition: glew.h:2157
void setUniform3iv(const char *_varname, size_t _count, const GLint *_value) const noexcept
sets &#39;_varname&#39; as a 3D int array
#define GL_SAMPLER_2D_RECT_SHADOW
Definition: glew.h:2292
GLint getUniformLocation(const char *_name) const noexcept
returns the ID of the uniform attribute called &#39;name&#39;.
#define glUniform4i
Definition: glew.h:1959
#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY
Definition: glew.h:6184
void setUniformMatrix4x2fv(const char *_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 4x2 matrix array
int GLsizei
Definition: glew.h:282
NGL_DLLEXPORT void NGLCheckGLError(const std::string &_file, const int _line) noexcept
check for openGL errors and print out.
Definition: Util.cpp:101
GLsizei const GLchar *const * string
Definition: glew.h:1847
#define glDeleteProgram
Definition: glew.h:1916
#define GL_FLOAT_VEC2
Definition: glew.h:1776
#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY
Definition: glew.h:6177
void setRegisteredUniformMatrix3fv(const std::string &_varname, size_t _count, bool _transpose, const float *_value) const noexcept
sets &#39;_varname&#39; as a 3D matrix array
#define GL_FLOAT_VEC4
Definition: glew.h:1778
#define GL_BOOL_VEC3
Definition: glew.h:1784
#define GL_SAMPLER_2D_SHADOW
Definition: glew.h:1794
void setUniform1f(const char *_varname, float __v0) const noexcept
sets &#39;_varname&#39; as a float
#define GL_SAMPLER_1D_ARRAY
Definition: glew.h:2141