hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/platform/opengl/opengl_texture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/opengl/opengl_texture.cpp')
-rw-r--r--src/platform/opengl/opengl_texture.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/platform/opengl/opengl_texture.cpp b/src/platform/opengl/opengl_texture.cpp
index 87e9345..100909f 100644
--- a/src/platform/opengl/opengl_texture.cpp
+++ b/src/platform/opengl/opengl_texture.cpp
@@ -55,6 +55,7 @@ namespace Donut
std::cout << "Data must be entire texture!" << std::endl;
return;
}
+
glTextureSubImage2D(m_renderer_id, 0, 0, 0, m_width, m_height, m_data_format, GL_UNSIGNED_BYTE, data);
}
@@ -62,4 +63,10 @@ namespace Donut
{
glBindTextureUnit(slot, m_renderer_id);
}
+
+ void OpenGLTexture2D::bind_as_image(uint32_t slot, bool read_only) const
+ {
+ GLenum access = read_only ? GL_READ_ONLY : GL_WRITE_ONLY;
+ glBindImageTexture(slot, m_renderer_id, 0, GL_FALSE, 0, access, m_internal_format);
+ }
};