hyporo-cpp/source/hyporo/gpu/opengl/buffer.cpp

32 lines
496 B
C++
Raw Normal View History

2022-10-03 18:51:34 +05:00
#include "buffer.hpp"
2022-10-05 21:10:51 +05:00
#include <glad/glad.h>
2022-10-03 18:51:34 +05:00
namespace hpr::gpu::opengl
{
Buffer::Buffer() :
gpu::Buffer(DeviceAPI::OpenGL),
p_bufferIndex {0},
p_vertexArrayIndex {0}
{}
Buffer::~Buffer()
{}
2022-10-05 21:10:51 +05:00
int Buffer::target() const
2022-10-03 18:51:34 +05:00
{
switch (p_type)
{
case BufferType::Vertex:
return GL_ARRAY_BUFFER;
case BufferType::Index:
2022-10-05 21:10:51 +05:00
return GL_ELEMENT_ARRAY_BUFFER;
default:
return GL_NONE;
2022-10-03 18:51:34 +05:00
}
}
}