Route paint texture unit binding through GL backend
This commit is contained in:
@@ -166,14 +166,36 @@ pp::renderer::gl::OpenGlPixelFormat texture_format_for_image_channels(int channe
|
||||
return pp::renderer::gl::texture_format_for_channel_count(static_cast<std::uint32_t>(channel_count));
|
||||
}
|
||||
|
||||
void activate_opengl_texture(std::uint32_t texture_unit) noexcept
|
||||
{
|
||||
glActiveTexture(static_cast<GLenum>(texture_unit));
|
||||
}
|
||||
|
||||
void bind_opengl_texture(std::uint32_t target, std::uint32_t texture) noexcept
|
||||
{
|
||||
glBindTexture(static_cast<GLenum>(target), static_cast<GLuint>(texture));
|
||||
}
|
||||
|
||||
void set_active_texture_unit(std::uint32_t unit_index)
|
||||
{
|
||||
glActiveTexture(pp::renderer::gl::active_texture_unit(unit_index));
|
||||
const auto status = pp::renderer::gl::activate_opengl_texture_unit(
|
||||
unit_index,
|
||||
pp::renderer::gl::OpenGlActiveTextureDispatch {
|
||||
.active_texture = activate_opengl_texture,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Canvas active texture dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void unbind_texture_2d()
|
||||
{
|
||||
glBindTexture(texture_2d_target(), 0);
|
||||
const auto status = pp::renderer::gl::bind_opengl_texture_2d(
|
||||
0U,
|
||||
pp::renderer::gl::OpenGlTexture2DBindDispatch {
|
||||
.bind_texture = bind_opengl_texture,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Canvas texture unbind dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void gen_opengl_renderbuffers(std::uint32_t count, std::uint32_t* ids) noexcept
|
||||
|
||||
Reference in New Issue
Block a user