diff options
| author | hachem <im@hachem.wtf> | 2026-08-20 02:27:02 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-20 02:40:07 +0200 |
| commit | 5b361d81dbd2af0d0e99b9eb1adebea76ff05db0 (patch) | |
| tree | 34db1df17e8c7248aeeb92156d635d31c2484e3f /src/rendering/texture_manager.cpp | |
| parent | e3abaaf59777258ba06705135a0cafcb5918ad12 (diff) | |
[chore]: MASSIVE refactor + more vulkan bs
Diffstat (limited to 'src/rendering/texture_manager.cpp')
| -rw-r--r-- | src/rendering/texture_manager.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/rendering/texture_manager.cpp b/src/rendering/texture_manager.cpp new file mode 100644 index 0000000..ad2c68b --- /dev/null +++ b/src/rendering/texture_manager.cpp @@ -0,0 +1,34 @@ +#include "texture_manager.h" +#include "platform/opengl/opengl_texture.h" +#include "platform/opengl/opengl_renderer_api.h" +#include <glad/glad.h> + +namespace Donut +{ + auto TextureManager::create_texture(uint32_t width, uint32_t height) -> Ref<Texture2D> + { + return create_ref<OpenGLTexture2D>(width, height); + } + + auto TextureManager::bind_texture(uint32_t texture_id, uint32_t slot) -> void + { + RenderCommand::bind_texture(texture_id, slot); + } + + auto TextureManager::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only) -> void + { + RenderCommand::bind_image_texture(texture_id, slot, read_only); + } + + auto TextureManager::set_texture_data(uint32_t texture_id, void* data, uint32_t width, uint32_t height) -> void + { + glBindTexture(GL_TEXTURE_2D, texture_id); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); + } + + auto TextureManager::resize_texture(uint32_t texture_id, uint32_t width, uint32_t height) -> void + { + glBindTexture(GL_TEXTURE_2D, texture_id); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + } +}; |
