aboutsummaryrefslogtreecommitdiff
path: root/src/Rendering/Texture.cpp
blob: a52a4698afbd236223ef549f64af221fff388e8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
        }
    }
};