diff options
| author | hachem <im@hachem.wtf> | 2025-08-13 18:20:54 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-13 18:20:54 +0200 |
| commit | 2d8f706efe6e0a02b3238c2f22e7cdce620e9807 (patch) | |
| tree | 06734503f8422c1509da09b5dd6a3ce50bad875c /src/platform/opengl/opengl_texture.cpp | |
| parent | 3b02022fd79ad0e130b8c49e7707d221bfc97bb5 (diff) | |
feat: compute shaders and compute textures
Diffstat (limited to 'src/platform/opengl/opengl_texture.cpp')
| -rw-r--r-- | src/platform/opengl/opengl_texture.cpp | 7 |
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); + } }; |
