...
This commit is contained in:
14
source/opengl/handles/index_buffer_handle.ipp
Normal file
14
source/opengl/handles/index_buffer_handle.ipp
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef INCLUDE_INDEX_BUFFER_HANDLE_IMPLEMENTATION
|
||||
#error Never include this file directly include 'index_buffer_handle.hpp'
|
||||
#endif
|
||||
|
||||
|
||||
void zgl::index_buffer_handle::bind() const
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_id);
|
||||
}
|
||||
|
||||
void zgl::index_buffer_handle::unbind()
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
|
||||
|
||||
auto curr_attribute_flag = attribute_support_type{ 1 };
|
||||
for (const auto& attribute : attributes) {
|
||||
const auto location = glGetAttribLocation(program_id, attribute.name);
|
||||
const auto location = glGetAttribLocation(id, attribute.name);
|
||||
if (location == attribute.info.location)
|
||||
{
|
||||
attribute_candidates |= curr_attribute_flag;
|
||||
@@ -36,7 +36,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
|
||||
auto supported_attributes = attribute_support_type{};
|
||||
|
||||
GLint count;
|
||||
glGetProgramiv(program_id, GL_ACTIVE_ATTRIBUTES, &count);
|
||||
glGetProgramiv(id, GL_ACTIVE_ATTRIBUTES, &count);
|
||||
if (check_error()) ztu::logger::error("GL_err: %", error.message());
|
||||
|
||||
for (GLint i{}; i != count and attribute_candidates; ++i)
|
||||
@@ -46,7 +46,7 @@ shader_program_handle::attribute_support_type shader_program_handle::check_attri
|
||||
GLsizei name_length;
|
||||
auto name = std::array<char, 256>{};
|
||||
glGetActiveAttrib(
|
||||
program_id, i,
|
||||
id, i,
|
||||
name.size(),
|
||||
&name_length,
|
||||
&size, &type,
|
||||
@@ -93,12 +93,12 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
|
||||
auto curr_uniform_flag = uniform_support_type{ 1 };
|
||||
for (const auto& uniform : uniforms)
|
||||
{
|
||||
const auto location = glGetUniformLocation(program_id, uniform.name);
|
||||
const auto location = glGetUniformLocation(id, uniform.name);
|
||||
|
||||
if (location == uniform.info.location)
|
||||
{
|
||||
uniform_candidates |= curr_uniform_flag;
|
||||
ztu::logger::debug("[%] '%': %.", program_id, uniform.name, location);
|
||||
ztu::logger::debug("[%] '%': %.", id, uniform.name, location);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,7 +110,7 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
|
||||
auto supported_uniforms = uniform_support_type{};
|
||||
|
||||
GLint count;
|
||||
glGetProgramiv(program_id, GL_ACTIVE_UNIFORMS, &count);
|
||||
glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &count);
|
||||
if (check_error()) ztu::logger::error("GL_err: %", error.message());
|
||||
|
||||
for (GLint i{}; i != count and uniform_candidates; ++i)
|
||||
@@ -120,7 +120,7 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
|
||||
GLsizei name_length;
|
||||
auto name = std::array<char, 256>{};
|
||||
glGetActiveUniform(
|
||||
program_id, i,
|
||||
id, i,
|
||||
name.size(),
|
||||
&name_length,
|
||||
&size, &type,
|
||||
@@ -149,4 +149,9 @@ shader_program_handle::uniform_support_type shader_program_handle::check_uniform
|
||||
|
||||
return supported_uniforms;
|
||||
}
|
||||
|
||||
bool shader_program_handle::valid() const
|
||||
{
|
||||
return id != 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace zgl
|
||||
{
|
||||
inline void shader_program_handle::bind() const
|
||||
{
|
||||
glUseProgram(program_id);
|
||||
glUseProgram(id);
|
||||
}
|
||||
|
||||
inline void shader_program_handle::unbind()
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace zgl
|
||||
{
|
||||
inline void texture_handle::bind() const
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, texture_id);
|
||||
glBindTexture(GL_TEXTURE_2D, m_id);
|
||||
}
|
||||
|
||||
inline void texture_handle::unbind()
|
||||
|
||||
14
source/opengl/handles/vertex_buffer_handle.ipp
Normal file
14
source/opengl/handles/vertex_buffer_handle.ipp
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef INCLUDE_VERTEX_BUFFER_HANDLE_IMPLEMENTATION
|
||||
#error Never include this file directly include 'vertex_buffer_handle.hpp'
|
||||
#endif
|
||||
|
||||
|
||||
void zgl::vertex_buffer_handle::bind() const
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_id);
|
||||
}
|
||||
|
||||
void zgl::vertex_buffer_handle::unbind()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user