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..a52a469
--- /dev/null
+++ b/src/Rendering/Texture.cpp
@@ -0,0 +1,32 @@
+#include "Texture.h"
+#include "Renderer.h"
+#include "../Platform/OpenGL/OpenGLTexture.h"
+
+namespace Donut
+{
+ std::shared_ptr<Texture2D> Texture2D::Create(uint32_t width, uint32_t height)
+ {
+ switch (Renderer::GetAPI())
+ {
+ 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::GetAPI())
+ {
+ case RendererAPI::API::OpenGL:
+ return std::make_shared<OpenGLTexture2D>(path);
+ case RendererAPI::API::None:
+ return nullptr;
+ default:
+ return nullptr;
+ }
+ }
+}; \ No newline at end of file