#include "../../../include/RenderBackend/OpenGL/DeviceMemory.hpp" #include "../../../include/RenderBackend/OpenGL/opengl.hpp" namespace amalgine { DeviceMemory::DeviceMemory() { glGenBuffers(1, &vertexBufferObjectId); } void DeviceMemory::copyStatic(const DataView &data) { copy(data, GL_STATIC_DRAW); } void DeviceMemory::copyDynamic(const DataView &data) { copy(data, GL_DYNAMIC_DRAW); } void DeviceMemory::copyStream(const DataView &data) { copy(data, GL_STREAM_DRAW); } void DeviceMemory::copy(const DataView &data, i32 storageType) { glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObjectId); glBufferData(GL_ARRAY_BUFFER, data.getByteSize(), data.data, storageType); } }