1 #ifndef _MGGLSLPROGRAM_H
2 #define _MGGLSLPROGRAM_H
10 #include <glm/glm.hpp>
78 MG_DLL_DECLR
void dumpGLInfo(
bool dumpExtensions =
false);
88 const GLchar* message,
157 TESS_CONTROL, TESS_EVALUATION
170 unsigned short usName[2];
171 unsigned char ucName[4];
178 bool compileShaderFromFile(
const char* fileName,
GLSLShaderType type);
181 bool compileShaderFromString(
const std::string& source,
GLSLShaderType type);
202 void bindAttribLocation( GLuint location,
const char * name);
211 void bindFragDataLocation( GLuint location,
const char * name );
214 int getvPositionLocation()
const;
215 int getvColorLocation()
const;
216 int getvNormalLocation()
const;
217 int getvTextureCoordLocation()
const;
220 GLint getUniformLocation(
const char* name)
const;
222 return getUniformLocation(name.c_str());
227 void setUniform( GLint loc,
float x,
float y,
float z);
228 void setUniform( GLint loc,
const glm::vec3& v);
229 void setUniform( GLint loc,
const glm::vec4& v);
230 void setUniform( GLint loc,
const glm::mat4& m);
231 void setUniform( GLint loc,
const glm::mat3& m);
232 void setUniform( GLint loc,
float val);
233 void setUniform( GLint loc,
int val);
234 void setUniform( GLint loc,
bool val);
237 void printActiveUniforms();
238 void printActiveAttribs();
241 void EnableLights(
bool bEnabled =
true);
245 static const size_t MAX_ATTRIB_LOC = 20;
248 modelViewProjMatrix=0,
275 void setUniform( UniformName name,
float x,
float y,
float z);
276 void setUniform( UniformName name,
const glm::vec3& v);
277 void setUniform( UniformName name,
const glm::vec4& v);
278 void setUniform( UniformName name,
const glm::mat4& m);
279 void setUniform( UniformName name,
const glm::mat3& m);
280 void setUniform( UniformName name,
float val);
281 void setUniform( UniformName name,
int val);
282 void setUniform( UniformName name,
bool val);
285 static const GLint LIGHT_NUM = 10;
286 static const GLint PROP_NUM = 11;
302 void setUniformLights( GLint lightNo, LightProps name,
float x,
float y,
float z);
303 void setUniformLights( GLint lightNo, LightProps name,
const glm::vec3& v);
304 void setUniformLights( GLint lightNo, LightProps name,
const glm::vec4& v);
305 void setUniformLights( GLint lightNo, LightProps name,
const glm::mat4& m);
306 void setUniformLights( GLint lightNo, LightProps name,
const glm::mat3& m);
307 void setUniformLights( GLint lightNo, LightProps name,
float val);
308 void setUniformLights( GLint lightNo, LightProps name,
int val);
309 void setUniformLights( GLint lightNo, LightProps name,
bool val);
311 void setOpenGLVersion();
314 void getOpenGLVerion(GLint& major, GLint& minor)
const;
316 void printPrjMatrix();
318 void printLightProps();
320 void printLightProps(GLint lightNo);
327 GLint m_VersionMajor, m_VersionMinor;
329 std::string m_logString;
332 GLint m_uniform_locations[MAX_ATTRIB_LOC];
334 GLint m_LightPropsIds[LIGHT_NUM][PROP_NUM];
337 void build_attribLocations();
340 void build_attribLocationsLight();
342 int getAttribLocation(
const char* name)
const;
343 bool fileExists(
const std::string& fileName)
const;
348 #endif // _MGGLSLPROGRAM_H
Definition: glslprogram.h:26
MG_DLL_DECLR void printOpenGLError(int errorCode)
change error code to string and print it.
Definition: glslprogram.h:297
MG_DLL_DECLR void CALLBACK debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, void *userParam)
MG_DLL_DECLR void initializeStaticGLAttribStack()
Definition: glslprogram.h:49
Definition: glslprogram.h:257
Definition: glslprogram.h:295
Definition: glslprogram.h:263
GLint getUniformLocation(const std::string &name) const
Definition: glslprogram.h:221
MG_DLL_DECLR void pushStaticGLAttrib()
Definition: glslprogram.h:290
MG_DLL_DECLR bool LightEnabled()
MG_DLL_DECLR std::stack< mgStaticGLAttrib > & getStaticGLAttribStack()
Definition: glslprogram.h:156
mgStaticGLAttrib defines MGColor and line width data of OpenGL.
Definition: StaticGLAttrib.h:16
Definition: glslprogram.h:36
FuncType
Definition: glslprogram.h:35
Definition: glslprogram.h:298
Definition: glslprogram.h:264
Definition: glslprogram.h:271
GLSLShaderType
CreateShaderのタイプ列挙子
Definition: glslprogram.h:155
MG_DLL_DECLR int checkForOpenGLError(const char *, int)
Returns 1 if an OpenGL error occurred, 0 otherwise.
Definition: glslprogram.h:269
MG_DLL_DECLR mgStaticGLAttrib & getCurrentStaticGLAttrib()
Definition: glslprogram.h:258
Definition: glslprogram.h:272
Definition: glslprogram.h:65
Definition: glslprogram.h:27
Definition: glslprogram.h:292
Definition: glslprogram.h:50
Definition: glslprogram.h:164
Definition: glslprogram.h:253
MGColor defines the OpenGL color (R,G,B,A).
Definition: Color.h:26
Definition: glslprogram.h:296
DrawType
Definition: glslprogram.h:25
Definition: glslprogram.h:268
Definition: glslprogram.h:294
Definition: glslprogram.h:58
Definition: glslprogram.h:249
Definition: glslprogram.h:47
Definition: glslprogram.h:293
Definition: glslprogram.h:66
Definition: glslprogram.h:266
MG_DLL_DECLR void execStaticLineWidth(float lineWidth)
Definition: glslprogram.h:261
Definition: glslprogram.h:254
MG_DLL_DECLR void execLightMode(int mode)
Definition: glslprogram.h:18
mgGLSLProgramはOpenGL Shader Programをcompile , linkしてそのuniform変数の管理を行います.
Definition: glslprogram.h:151
MG_DLL_DECLR void dumpGLInfo(bool dumpExtensions=false)
unsigned uiName
Definition: glslprogram.h:169
MG_DLL_DECLR void setColorAsSelectionName(unsigned name)
Set static color as selection name.
MG_DLL_DECLR void execStaticLineStipple(short int factor, GLuint pattern)
Definition: glslprogram.h:37
Definition: glslprogram.h:255
MG_DLL_DECLR void execStaticColorAttrib(const MGColor &color)
Definition: glslprogram.h:57
Definition: glslprogram.h:168
ZebraType
Definition: glslprogram.h:64
Definition: glslprogram.h:291
Definition: glslprogram.h:163
Definition: glslprogram.h:259
Definition: glslprogram.h:38
MG_DLL_DECLR void execStaticGLAttrib(const mgStaticGLAttrib &attrib)
CoordinateType
Definition: glslprogram.h:46
ShadeMode
Definition: glslprogram.h:56
MG_DLL_DECLR void popStaticGLAttrib()
Utility class to invoke glsl's setFuncType.
Definition: glslprogram.h:113
Definition: glslprogram.h:251
Definition: glslprogram.h:48
Definition: glslprogram.h:250
Definition: glslprogram.h:28