55 #include <ACG/Config/ACGDefines.hh> 56 #include <ACG/Math/VectorT.hh> 57 #include <ACG/Math/GLMatrixT.hh> 58 #include <ACG/GL/gl.hh> 62 #include <QStringList> 71 #define GLSL_MAX_LOGSIZE 16384 73 typedef std::list<std::string> StringList;
82 void setSource(
const StringList& source);
83 void setSource(
const QStringList& source);
86 bool compile(
bool verbose =
true);
142 #ifdef GL_ARB_tessellation_shader 146 class ACGDLLEXPORT TessControlShader :
public Shader {
150 virtual ~TessControlShader();
153 typedef TessControlShader* PtrTessControlShader;
154 typedef const TessControlShader* PtrConstTessControlShader;
160 class ACGDLLEXPORT TessEvaluationShader :
public Shader {
163 TessEvaluationShader();
164 virtual ~TessEvaluationShader();
167 typedef TessEvaluationShader* PtrTessEvaluationShader;
168 typedef const TessEvaluationShader* PtrConstTessEvaluationShader;
170 #endif // GL_ARB_tessellation_shader 186 int maxUniformBlocks_;
187 int maxTextureImageUnits_;
188 int maxImageUniforms_;
189 int maxSharedMemorySize_;
190 int maxUniformComponents_;
191 int maxAtomicCounterBufs_;
192 int maxAtomicCounters_;
193 int maxCombinedUniformComponents_;
194 int maxWorkGroupInvocations_;
195 int maxWorkGroupCount_[3];
196 int maxWorkGroupSize_[3];
199 static const Caps& caps();
204 static bool capsInitialized_;
231 void attach(PtrConstShader _shader);
232 void detach(PtrConstShader _shader);
243 int getAttributeLocation(
const char *_name);
244 int getUniformLocation(
const char *_name);
245 int getFragDataLocation(
const char* _name);
247 void bindAttributeLocation(
unsigned int _index,
const char *_name);
248 void bindFragDataLocation(
unsigned int _index,
const char *_name);
258 void setUniform(
const char *_name, GLint _value);
259 void setUniform(
const char *_name,
const ACG::Vec2i &_value);
260 void setUniform(
const char *_name,
const ACG::Vec3i &_value);
261 void setUniform(
const char *_name,
const ACG::Vec4i &_value);
263 void setUniform(
const char *_name, GLuint _value);
264 void setUniform(
const char *_name,
const ACG::Vec2ui &_value);
265 void setUniform(
const char *_name,
const ACG::Vec3ui &_value);
266 void setUniform(
const char *_name,
const ACG::Vec4ui &_value);
268 void setUniform(
const char *_name, GLfloat _value);
269 void setUniform(
const char *_name,
const ACG::Vec2f &_value);
270 void setUniform(
const char *_name,
const ACG::Vec3f &_value);
271 void setUniform(
const char *_name,
const ACG::Vec4f &_value);
274 void setUniform(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
275 void setUniformMat3(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
279 void setUniform(
const char *_name,
const GLint *_values,
int _count);
280 void setUniform(
const char *_name,
const GLfloat *_values,
int _count);
281 void setUniform(
const char *_name,
const ACG::Vec2f *_values,
int _count);
282 void setUniform(
const char *_name,
const ACG::Vec3f *_values,
int _count);
283 void setUniform(
const char *_name,
const ACG::Vec4f *_values,
int _count);
284 void setUniform(
const char *_name,
int _index,
bool _value);
286 void setUniform(
const char *_name,
int _index,
int _value);
287 void setUniform(
const char *_name,
int _index,
float _value);
299 GLuint getUniformBlockIndex(
const char *_name);
301 void setUniformBlockBinding(GLuint _index,
int _binding);
302 void setUniformBlockBinding(
const char *_name,
int _binding);
304 int getUniformBlockSize(GLuint _index);
305 int getUniformBlockSize(
const char *_name);
307 void getUniformBlockOffsets(
int _numUniforms,
const char **_names,
int *_outOffsets);
318 void setGeometryInputType(GLint _type);
319 void setGeometryOutputType(GLint _type);
320 void setGeometryVertexCount(GLint _numVerticesOut);
337 GLuint getProgramId();
341 std::list<PtrConstShader> m_linkedShaders;
352 GLSL::StringList ACGDLLEXPORT
loadShader(
const char *filename,
const GLSL::StringList *macros = 0,
bool appendNewLineChar =
true, GLSL::StringList *outIncludes = 0);
367 const char *fragmentShaderFile,
368 const GLSL::StringList *macros = 0,
369 bool verbose =
true);
377 const char *geometryShaderFile,
378 const char *fragmentShaderFile,
379 const GLSL::StringList *macros = 0,
380 bool verbose =
true);
388 const char *tessControlShaderFile,
389 const char *tessEvaluationShaderFile,
390 const char *geometryShaderFile,
391 const char *fragmentShaderFile,
392 const GLSL::StringList *macros = 0,
393 bool verbose =
true);
401 const GLSL::StringList *macros = 0,
402 bool verbose =
true);
405 #endif // GLSLSHADER_H GLSL::PtrFragmentShader loadFragmentShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new vertex shader.
A generic shader base class.
GLSL::PtrProgram loadComputeProgram(const char *computeShaderFile, const GLSL::StringList *macros, bool verbose)
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
GLSL::StringList loadShader(const char *filename, const GLSL::StringList *macros, bool appendNewLineChar, GLSL::StringList *outIncludes)
Loads the shader source.
GLSL::PtrShader loadTessEvaluationShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new tessellation evaluation shader.
GLSL::PtrGeometryShader loadGeometryShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new vertex shader.
GLSL::PtrShader loadTessControlShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new tessellation control shader.
GLSL::PtrComputeShader loadComputeShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new compute shader.
GLSL::PtrVertexShader loadVertexShader(const char *name, const GLSL::StringList *macros, bool verbose)
Loads, compiles and installs a new vertex shader.
This namespace contains all the classes and functions for handling GLSL shader and program objects...