hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/rendering/texture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendering/texture.cpp')
-rw-r--r--src/rendering/texture.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/rendering/texture.cpp b/src/rendering/texture.cpp
new file mode 100644
index 0000000..9603034
--- /dev/null
+++ b/src/rendering/texture.cpp
@@ -0,0 +1,32 @@
+#include "texture.h"
+#include "renderer.h"
+#include "../platform/opengl/opengl_texture.h"
+
+namespace Donut
+{
+ std::shared_ptr<Texture2D> Texture2D::create(uint32_t width, uint32_t height)
+ {
+ switch (Renderer::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return std::make_shared<OpenGLTexture2D>(width, height);
+ case RendererAPI::API::None:
+ return nullptr;
+ default:
+ return nullptr;
+ }
+ }
+
+ std::shared_ptr<Texture2D> Texture2D::create(const std::string& path)
+ {
+ switch (Renderer::get_api())
+ {
+ case RendererAPI::API::OpenGL:
+ return std::make_shared<OpenGLTexture2D>(path);
+ case RendererAPI::API::None:
+ return nullptr;
+ default:
+ return nullptr;
+ }
+ }
+};