add glad to load OpenGL extensions

This commit is contained in:
2019-07-09 11:07:01 +02:00
parent 81b62d9a27
commit 4cbf0c47b4
20 changed files with 65 additions and 209 deletions

View File

@@ -290,19 +290,16 @@ void Shader::destroy()
void Shader::use()
{
assert(App::I.is_render_thread());
glUseProgram(prog);
}
void Shader::u_vec4(kShaderUniform id, const glm::vec4& v)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM vec4 %d NOT FOUND in shader %d", (int)id, (int)name)
else glUniform4fv(m_umap[id], 1, glm::value_ptr(v));
}
void Shader::u_vec3(kShaderUniform id, const glm::vec3& v)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM vec3 %d NOT FOUND in shader %d", (int)id, (int)name)
else glUniform3fv(m_umap[id], 1, glm::value_ptr(v));
@@ -310,7 +307,6 @@ void Shader::u_vec3(kShaderUniform id, const glm::vec3& v)
void Shader::u_vec2(kShaderUniform id, const glm::vec2& v)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM vec2 %d NOT FOUND in shader %d", (int)id, (int)name)
else glUniform2fv(m_umap[id], 1, glm::value_ptr(v));
@@ -318,14 +314,12 @@ void Shader::u_vec2(kShaderUniform id, const glm::vec2& v)
void Shader::u_mat4(kShaderUniform id, const glm::mat4& m)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM mat4 %d NOT FOUND in shader %d", (int)id, (int)name)
else glUniformMatrix4fv(m_umap[id], 1, GL_FALSE, glm::value_ptr(m));
}
void Shader::u_int(kShaderUniform id, int i)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM int %d NOT FOUND in shader %d", (int)id, (int)name)
else
@@ -333,14 +327,12 @@ void Shader::u_int(kShaderUniform id, int i)
}
void Shader::u_float(kShaderUniform id, float f)
{
assert(App::I.is_render_thread());
if (m_umap.count(id) == 0)
LOG("UNIFORM float %d NOT FOUND in shader %d", (int)id, (int)name)
else glUniform1f(m_umap[id], f);
}
GLint Shader::GetAttribLocation(const char* name)
{
assert(App::I.is_render_thread());
return glGetAttribLocation(prog, name);
}