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 | f1517709556827fb8b7bab00bdee4a9794d88dd1 (patch) | |
| tree | a1b2325c8bc693bff0ace1fd98ea7dac91f76286 /src/Platform/OpenGL/OpenGLTexture.cpp | |
| parent | 1ad6bc34323f5b30d463ebe47a58d47ff9d4f328 (diff) | |
[add]: Compute shaders and Compute Textures
Diffstat (limited to 'src/Platform/OpenGL/OpenGLTexture.cpp')
| -rw-r--r-- | src/Platform/OpenGL/OpenGLTexture.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Platform/OpenGL/OpenGLTexture.cpp b/src/Platform/OpenGL/OpenGLTexture.cpp index 02252d1..7e2dea0 100644 --- a/src/Platform/OpenGL/OpenGLTexture.cpp +++ b/src/Platform/OpenGL/OpenGLTexture.cpp @@ -19,7 +19,7 @@ namespace Donut glTextureParameteri(m_RendererID, GL_TEXTURE_WRAP_T, GL_REPEAT); } - // TODO: Texture Loading + // TODO(Hachem): Texture Loading OpenGLTexture2D::OpenGLTexture2D(const std::string& path) : m_Path(path) { @@ -56,6 +56,7 @@ namespace Donut std::cout << "Data must be entire texture!" << std::endl; return; } + glTextureSubImage2D(m_RendererID, 0, 0, 0, m_Width, m_Height, m_DataFormat, GL_UNSIGNED_BYTE, data); } @@ -63,4 +64,10 @@ namespace Donut { glBindTextureUnit(slot, m_RendererID); } + + void OpenGLTexture2D::BindAsImage(uint32_t slot, bool readOnly) const + { + GLenum access = readOnly ? GL_READ_ONLY : GL_WRITE_ONLY; + glBindImageTexture(slot, m_RendererID, 0, GL_FALSE, 0, access, m_InternalFormat); + } };
\ No newline at end of file |
