forked from organicmaps/organicmaps
FIx opengl depending on windows platform
This commit is contained in:
parent
cdc56d1fcc
commit
201a01fcaf
6 changed files with 167 additions and 71 deletions
|
@ -388,7 +388,7 @@ namespace graphics
|
|||
// Disable dither to fix 4-bit textures "grid" issue on Nvidia Tegra cards
|
||||
OGLCHECK(glDisable(GL_DITHER));
|
||||
|
||||
OGLCHECK(glActiveTexture(GL_TEXTURE0));
|
||||
OGLCHECK(glActiveTextureFn(GL_TEXTURE0));
|
||||
|
||||
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
|
@ -458,7 +458,7 @@ namespace graphics
|
|||
// Disable dither to fix 4-bit textures "grid" issue on Nvidia Tegra cards
|
||||
OGLCHECK(glDisable(GL_DITHER));
|
||||
|
||||
OGLCHECK(glActiveTexture(GL_TEXTURE0));
|
||||
OGLCHECK(glActiveTextureFn(GL_TEXTURE0));
|
||||
|
||||
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
|
|
|
@ -2,6 +2,38 @@
|
|||
|
||||
// buffer objects extensions
|
||||
|
||||
DEFINE_GL_PROC("glActiveTexture", glActiveTextureFn)
|
||||
DEFINE_GL_PROC("glGetAttribLocation", glGetAttribLocationFn)
|
||||
DEFINE_GL_PROC("glGetActiveAttrib", glGetActiveAttribFn)
|
||||
DEFINE_GL_PROC("glGetActiveUniform", glGetActiveUniformFn)
|
||||
DEFINE_GL_PROC("glGetUniformLocation", glGetUniformLocationFn)
|
||||
DEFINE_GL_PROC("glGetProgramInfoLog", glGetProgramInfoLogFn)
|
||||
DEFINE_GL_PROC("glGetProgramiv", glGetProgramivFn)
|
||||
DEFINE_GL_PROC("glLinkProgram", glLinkProgramFn)
|
||||
DEFINE_GL_PROC("glAttachShader", glAttachShaderFn)
|
||||
DEFINE_GL_PROC("glCreateProgram", glCreateProgramFn)
|
||||
DEFINE_GL_PROC("glDeleteProgram", glDeleteProgramFn)
|
||||
DEFINE_GL_PROC("glVertexAttribPointer", glVertexAttribPointerFn)
|
||||
DEFINE_GL_PROC("glEnableVertexAttribArray", glEnableVertexAttribArrayFn)
|
||||
DEFINE_GL_PROC("glUniformMatrix4fv", glUniformMatrix4fvFn)
|
||||
DEFINE_GL_PROC("glUniformMatrix3fv", glUniformMatrix3fvFn)
|
||||
DEFINE_GL_PROC("glUniformMatrix2fv", glUniformMatrix2fvFn)
|
||||
DEFINE_GL_PROC("glUniform4i", glUniform4iFn)
|
||||
DEFINE_GL_PROC("glUniform3i", glUniform3iFn)
|
||||
DEFINE_GL_PROC("glUniform2i", glUniform2iFn)
|
||||
DEFINE_GL_PROC("glUniform1i", glUniform1iFn)
|
||||
DEFINE_GL_PROC("glUniform4f", glUniform4fFn)
|
||||
DEFINE_GL_PROC("glUniform3f", glUniform3fFn)
|
||||
DEFINE_GL_PROC("glUniform2f", glUniform2fFn)
|
||||
DEFINE_GL_PROC("glUniform1f", glUniform1fFn)
|
||||
DEFINE_GL_PROC("glUseProgram", glUseProgramFn)
|
||||
DEFINE_GL_PROC("glGetShaderInfoLog", glGetShaderInfoLogFn)
|
||||
DEFINE_GL_PROC("glGetShaderiv", glGetShaderivFn)
|
||||
DEFINE_GL_PROC("glCompileShader", glCompileShaderFn)
|
||||
DEFINE_GL_PROC("glShaderSource", glShaderSourceFn)
|
||||
DEFINE_GL_PROC("glCreateShader", glCreateShaderFn)
|
||||
DEFINE_GL_PROC("glDeleteShader", glDeleteShaderFn)
|
||||
|
||||
DEFINE_GL_PROC("glBindBuffer", glBindBufferFn)
|
||||
DEFINE_GL_PROC("glGenBuffers", glGenBuffersFn)
|
||||
DEFINE_GL_PROC("glBufferData", glBufferDataFn)
|
||||
|
|
|
@ -56,6 +56,38 @@ namespace graphics
|
|||
LOG(LINFO, ("--------------------------------------------"));
|
||||
}
|
||||
|
||||
void (OPENGL_CALLING_CONVENTION * glActiveTextureFn) (GLenum texture);
|
||||
GLint (OPENGL_CALLING_CONVENTION * glGetAttribLocationFn)(GLuint program, const GLchar *name);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetActiveAttribFn)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GLint (OPENGL_CALLING_CONVENTION * glGetUniformLocationFn)(GLuint program, const GLchar *name);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetActiveUniformFn)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetProgramInfoLogFn)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetProgramivFn)(GLuint program, GLenum pname, GLint *params);
|
||||
void (OPENGL_CALLING_CONVENTION * glLinkProgramFn)(GLuint program);
|
||||
void (OPENGL_CALLING_CONVENTION * glAttachShaderFn)(GLuint program, GLuint shader);
|
||||
GLuint (OPENGL_CALLING_CONVENTION * glCreateProgramFn)(void);
|
||||
void (OPENGL_CALLING_CONVENTION * glDeleteProgramFn)(GLuint program);
|
||||
void (OPENGL_CALLING_CONVENTION * glVertexAttribPointerFn)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
void (OPENGL_CALLING_CONVENTION * glEnableVertexAttribArrayFn)(GLuint index);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniformMatrix4fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniformMatrix3fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniformMatrix2fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform4iFn)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform3iFn)(GLint location, GLint v0, GLint v1, GLint v2);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform1iFn)(GLint location, GLint v0);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform2iFn)(GLint location, GLint v0, GLint v1);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform4fFn)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform3fFn)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform2fFn)(GLint location, GLfloat v0, GLfloat v1);
|
||||
void (OPENGL_CALLING_CONVENTION * glUniform1fFn)(GLint location, GLfloat v0);
|
||||
void (OPENGL_CALLING_CONVENTION * glUseProgramFn)(GLuint program);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetShaderInfoLogFn)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
void (OPENGL_CALLING_CONVENTION * glGetShaderivFn)(GLuint shader, GLenum pname, GLint *params);
|
||||
void (OPENGL_CALLING_CONVENTION * glCompileShaderFn)(GLuint shader);
|
||||
void (OPENGL_CALLING_CONVENTION * glShaderSourceFn)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
|
||||
GLuint (OPENGL_CALLING_CONVENTION * glCreateShaderFn)(GLenum type);
|
||||
void (OPENGL_CALLING_CONVENTION * glDeleteShaderFn)(GLuint shader);
|
||||
|
||||
// basic opengl functions and constants
|
||||
void (OPENGL_CALLING_CONVENTION * glEnableFn)(GLenum cap);
|
||||
void (OPENGL_CALLING_CONVENTION * glDisableFn)(GLenum cap);
|
||||
|
|
|
@ -141,6 +141,38 @@ namespace graphics
|
|||
|
||||
extern void (OPENGL_CALLING_CONVENTION * glBlendFuncSeparateFn) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
|
||||
extern void (OPENGL_CALLING_CONVENTION * glActiveTextureFn) (GLenum texture);
|
||||
extern GLint (OPENGL_CALLING_CONVENTION * glGetAttribLocationFn) (GLuint program, const GLchar *name);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetActiveAttribFn)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
extern GLint (OPENGL_CALLING_CONVENTION * glGetUniformLocationFn)(GLuint program, const GLchar *name);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetActiveUniformFn)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetProgramInfoLogFn)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetProgramivFn)(GLuint program, GLenum pname, GLint *params);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glLinkProgramFn)(GLuint program);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glAttachShaderFn)(GLuint program, GLuint shader);
|
||||
extern GLuint (OPENGL_CALLING_CONVENTION * glCreateProgramFn)(void);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glDeleteProgramFn)(GLuint program);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glVertexAttribPointerFn)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glEnableVertexAttribArrayFn)(GLuint index);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniformMatrix4fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniformMatrix3fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniformMatrix2fvFn)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform4iFn)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform3iFn)(GLint location, GLint v0, GLint v1, GLint v2);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform2iFn)(GLint location, GLint v0, GLint v1);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform1iFn)(GLint location, GLint v0);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform4fFn)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform3fFn)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform2fFn)(GLint location, GLfloat v0, GLfloat v1);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUniform1fFn)(GLint location, GLfloat v0);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glUseProgramFn)(GLuint program);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetShaderInfoLogFn)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glGetShaderivFn)(GLuint shader, GLenum pname, GLint *params);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glCompileShaderFn)(GLuint shader);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glShaderSourceFn)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
|
||||
extern GLuint (OPENGL_CALLING_CONVENTION * glCreateShaderFn)(GLenum type);
|
||||
extern void (OPENGL_CALLING_CONVENTION * glDeleteShaderFn)(GLuint shader);
|
||||
|
||||
/// This flag controls, whether OpenGL resources should delete themselves upon destruction.
|
||||
/// Sounds odd, but in EGL there are cases when the only function one should call to finish
|
||||
/// its work with resources is eglTerminate, which by itself internally deletes all OpenGL resources.
|
||||
|
|
|
@ -14,29 +14,29 @@ namespace graphics
|
|||
Program::Program(shared_ptr<Shader> const & vxShader,
|
||||
shared_ptr<Shader> const & frgShader)
|
||||
{
|
||||
m_handle = glCreateProgram();
|
||||
m_handle = glCreateProgramFn();
|
||||
OGLCHECKAFTER;
|
||||
|
||||
if (!m_handle)
|
||||
throw Exception("CreateProgram error", "could not create Program!");
|
||||
|
||||
OGLCHECK(glAttachShader(m_handle, vxShader->id()));
|
||||
OGLCHECK(glAttachShader(m_handle, frgShader->id()));
|
||||
OGLCHECK(glAttachShaderFn(m_handle, vxShader->id()));
|
||||
OGLCHECK(glAttachShaderFn(m_handle, frgShader->id()));
|
||||
|
||||
OGLCHECK(glLinkProgram(m_handle));
|
||||
OGLCHECK(glLinkProgramFn(m_handle));
|
||||
|
||||
int linkStatus = GL_FALSE;
|
||||
OGLCHECK(glGetProgramiv(m_handle, GL_LINK_STATUS, &linkStatus));
|
||||
OGLCHECK(glGetProgramivFn(m_handle, GL_LINK_STATUS, &linkStatus));
|
||||
|
||||
if (linkStatus != GL_TRUE)
|
||||
{
|
||||
int bufLength = 0;
|
||||
OGLCHECK(glGetProgramiv(m_handle, GL_INFO_LOG_LENGTH, &bufLength));
|
||||
OGLCHECK(glGetProgramivFn(m_handle, GL_INFO_LOG_LENGTH, &bufLength));
|
||||
if (bufLength)
|
||||
{
|
||||
vector<char> v;
|
||||
v.resize(bufLength);
|
||||
glGetProgramInfoLog(m_handle, bufLength, NULL, &v[0]);
|
||||
glGetProgramInfoLogFn(m_handle, bufLength, NULL, &v[0]);
|
||||
|
||||
throw LinkException("Could not link program: ", &v[0]);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace graphics
|
|||
/// getting all uniforms
|
||||
int cnt = 0;
|
||||
|
||||
OGLCHECK(glGetProgramiv(m_handle, GL_ACTIVE_UNIFORMS, &cnt));
|
||||
OGLCHECK(glGetProgramivFn(m_handle, GL_ACTIVE_UNIFORMS, &cnt));
|
||||
|
||||
GLchar name[1024];
|
||||
GLsizei len = 0;
|
||||
|
@ -59,9 +59,9 @@ namespace graphics
|
|||
Uniform f;
|
||||
ESemantic sem;
|
||||
|
||||
OGLCHECK(glGetActiveUniform(m_handle, i, ARRAY_SIZE(name), &len, &size, &type, name));
|
||||
OGLCHECK(glGetActiveUniformFn(m_handle, i, ARRAY_SIZE(name), &len, &size, &type, name));
|
||||
|
||||
f.m_handle = glGetUniformLocation(m_handle, name);
|
||||
f.m_handle = glGetUniformLocationFn(m_handle, name);
|
||||
OGLCHECKAFTER;
|
||||
|
||||
convert(type, f.m_type);
|
||||
|
@ -70,16 +70,16 @@ namespace graphics
|
|||
m_uniforms[sem] = f;
|
||||
}
|
||||
|
||||
OGLCHECK(glGetProgramiv(m_handle, GL_ACTIVE_ATTRIBUTES, &cnt));
|
||||
OGLCHECK(glGetProgramivFn(m_handle, GL_ACTIVE_ATTRIBUTES, &cnt));
|
||||
|
||||
for (unsigned i = 0; i < cnt; ++i)
|
||||
{
|
||||
Attribute a;
|
||||
ESemantic sem;
|
||||
|
||||
OGLCHECK(glGetActiveAttrib(m_handle, i, ARRAY_SIZE(name), &len, &size, &type, name));
|
||||
OGLCHECK(glGetActiveAttribFn(m_handle, i, ARRAY_SIZE(name), &len, &size, &type, name));
|
||||
|
||||
a.m_handle = glGetAttribLocation(m_handle, name);
|
||||
a.m_handle = glGetAttribLocationFn(m_handle, name);
|
||||
OGLCHECKAFTER;
|
||||
|
||||
convert(type, a.m_type, a.m_count);
|
||||
|
@ -91,7 +91,7 @@ namespace graphics
|
|||
|
||||
Program::~Program()
|
||||
{
|
||||
OGLCHECK(glDeleteProgram(m_handle));
|
||||
OGLCHECK(glDeleteProgramFn(m_handle));
|
||||
}
|
||||
|
||||
void Program::setParam(ESemantic sem, float v0)
|
||||
|
@ -256,13 +256,13 @@ namespace graphics
|
|||
GLenum t;
|
||||
convert(a.m_type, t);
|
||||
|
||||
OGLCHECK(glEnableVertexAttribArray(a.m_handle));
|
||||
OGLCHECK(glVertexAttribPointer(a.m_handle,
|
||||
a.m_count,
|
||||
t,
|
||||
false,
|
||||
a.m_stride,
|
||||
(void*)((unsigned char *)m_storage.m_vertices->glPtr() + a.m_offset)));
|
||||
OGLCHECK(glEnableVertexAttribArrayFn(a.m_handle));
|
||||
OGLCHECK(glVertexAttribPointerFn(a.m_handle,
|
||||
a.m_count,
|
||||
t,
|
||||
false,
|
||||
a.m_stride,
|
||||
(void*)((unsigned char *)m_storage.m_vertices->glPtr() + a.m_offset)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,69 +278,69 @@ namespace graphics
|
|||
switch (u.m_type)
|
||||
{
|
||||
case EFloat:
|
||||
OGLCHECK(glUniform1f(u.m_handle,
|
||||
u.m_data.m_floatVal[0]));
|
||||
OGLCHECK(glUniform1fFn(u.m_handle,
|
||||
u.m_data.m_floatVal[0]));
|
||||
break;
|
||||
case EFloatVec2:
|
||||
OGLCHECK(glUniform2f(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1]));
|
||||
OGLCHECK(glUniform2fFn(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1]));
|
||||
break;
|
||||
case EFloatVec3:
|
||||
OGLCHECK(glUniform3f(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1],
|
||||
u.m_data.m_floatVal[2]));
|
||||
OGLCHECK(glUniform3fFn(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1],
|
||||
u.m_data.m_floatVal[2]));
|
||||
break;
|
||||
case EFloatVec4:
|
||||
OGLCHECK(glUniform4f(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1],
|
||||
u.m_data.m_floatVal[2],
|
||||
u.m_data.m_floatVal[3]));
|
||||
OGLCHECK(glUniform4fFn(u.m_handle,
|
||||
u.m_data.m_floatVal[0],
|
||||
u.m_data.m_floatVal[1],
|
||||
u.m_data.m_floatVal[2],
|
||||
u.m_data.m_floatVal[3]));
|
||||
break;
|
||||
case EInteger:
|
||||
OGLCHECK(glUniform1i(u.m_handle,
|
||||
u.m_data.m_intVal[0]));
|
||||
OGLCHECK(glUniform1iFn(u.m_handle,
|
||||
u.m_data.m_intVal[0]));
|
||||
break;
|
||||
case EIntegerVec2:
|
||||
OGLCHECK(glUniform2i(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1]));
|
||||
OGLCHECK(glUniform2iFn(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1]));
|
||||
break;
|
||||
case EIntegerVec3:
|
||||
OGLCHECK(glUniform3i(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1],
|
||||
u.m_data.m_intVal[2]));
|
||||
OGLCHECK(glUniform3iFn(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1],
|
||||
u.m_data.m_intVal[2]));
|
||||
break;
|
||||
case EIntegerVec4:
|
||||
OGLCHECK(glUniform4i(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1],
|
||||
u.m_data.m_intVal[2],
|
||||
u.m_data.m_intVal[3]));
|
||||
OGLCHECK(glUniform4iFn(u.m_handle,
|
||||
u.m_data.m_intVal[0],
|
||||
u.m_data.m_intVal[1],
|
||||
u.m_data.m_intVal[2],
|
||||
u.m_data.m_intVal[3]));
|
||||
break;
|
||||
case EFloatMat2:
|
||||
OGLCHECK(glUniformMatrix2fv(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
OGLCHECK(glUniformMatrix2fvFn(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
break;
|
||||
case EFloatMat3:
|
||||
OGLCHECK(glUniformMatrix3fv(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
OGLCHECK(glUniformMatrix3fvFn(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
break;
|
||||
case EFloatMat4:
|
||||
OGLCHECK(glUniformMatrix4fv(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
OGLCHECK(glUniformMatrix4fvFn(u.m_handle,
|
||||
1,
|
||||
false,
|
||||
u.m_data.m_matVal));
|
||||
break;
|
||||
case ESampler2D:
|
||||
OGLCHECK(glUniform1i(u.m_handle,
|
||||
OGLCHECK(glUniform1iFn(u.m_handle,
|
||||
u.m_data.m_intVal[0]));
|
||||
break;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ namespace graphics
|
|||
|
||||
void Program::makeCurrent()
|
||||
{
|
||||
OGLCHECK(glUseProgram(m_handle));
|
||||
OGLCHECK(glUseProgramFn(m_handle));
|
||||
|
||||
m_storage.m_vertices->makeCurrent();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace graphics
|
|||
GLenum glType;
|
||||
convert(type, glType);
|
||||
|
||||
m_handle = glCreateShader(glType);
|
||||
m_handle = glCreateShaderFn(glType);
|
||||
OGLCHECKAFTER;
|
||||
|
||||
if (!m_handle)
|
||||
|
@ -23,24 +23,24 @@ namespace graphics
|
|||
|
||||
int len = strlen(src);
|
||||
|
||||
OGLCHECK(glShaderSource(m_handle, 1, &src, &len));
|
||||
OGLCHECK(glShaderSourceFn(m_handle, 1, &src, &len));
|
||||
|
||||
OGLCHECK(glCompileShader(m_handle));
|
||||
OGLCHECK(glCompileShaderFn(m_handle));
|
||||
|
||||
GLint compileRes;
|
||||
OGLCHECK(glGetShaderiv(m_handle, GL_COMPILE_STATUS, &compileRes));
|
||||
OGLCHECK(glGetShaderivFn(m_handle, GL_COMPILE_STATUS, &compileRes));
|
||||
|
||||
if (compileRes == GL_FALSE)
|
||||
{
|
||||
GLchar msg[256];
|
||||
OGLCHECK(glGetShaderInfoLog(m_handle, sizeof(msg), 0, msg));
|
||||
OGLCHECK(glGetShaderInfoLogFn(m_handle, sizeof(msg), 0, msg));
|
||||
throw CompileException("Couldn't compile shader: ", msg);
|
||||
}
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
{
|
||||
OGLCHECK(glDeleteShader(m_handle));
|
||||
OGLCHECK(glDeleteShaderFn(m_handle));
|
||||
}
|
||||
|
||||
GLuint Shader::id() const
|
||||
|
|
Loading…
Add table
Reference in a new issue