This commit is contained in:
Lauchmelder 2021-12-24 15:14:15 +01:00
parent 5811d3676a
commit 988a429f16
4 changed files with 6 additions and 6 deletions

View file

@ -7,7 +7,7 @@ namespace lol
class ElementBuffer : public Buffer
{
public:
ElementBuffer(size_t count, unsigned int* elements, Usage usage = Usage::StaticDraw);
ElementBuffer(size_t count, const std::vector<unsigned int>& elements, Usage usage = Usage::StaticDraw);
inline size_t GetCount() const { return count; }

View file

@ -35,7 +35,7 @@ namespace lol
class VertexBuffer : public Buffer
{
public:
VertexBuffer(size_t size, float* data, Usage usage = Usage::StaticDraw);
VertexBuffer(size_t size, const std::vector<float>& data, Usage usage = Usage::StaticDraw);
inline void SetLayout(const BufferLayout& layout) { this->layout = layout; };
inline const BufferLayout& GetLayout() { return layout; }

View file

@ -2,9 +2,9 @@
namespace lol
{
ElementBuffer::ElementBuffer(size_t count, unsigned int* elements, Usage usage) :
ElementBuffer::ElementBuffer(size_t count, const std::vector<unsigned int>& elements, Usage usage) :
Buffer(BufferType::ElementArray), count(count)
{
glBufferData(NATIVE(type), count * sizeof(unsigned int), elements, NATIVE(usage));
glBufferData(NATIVE(type), count * sizeof(unsigned int), elements.data(), NATIVE(usage));
}
}

View file

@ -15,9 +15,9 @@ namespace lol
}
VertexBuffer::VertexBuffer(size_t size, float* data, Usage usage) :
VertexBuffer::VertexBuffer(size_t size, const std::vector<float>& data, Usage usage) :
Buffer(BufferType::Array), layout{}
{
glBufferData(NATIVE(type), size * sizeof(float), (void*)data, NATIVE(usage));
glBufferData(NATIVE(type), size * sizeof(float), data.data(), NATIVE(usage));
}
}