aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-02-15 02:03:07 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-18 15:22:10 +0100
commit92a30e08849f45fa6f5efb1dd8897a4a69c063a6 (patch)
treefb2caa668aabc96b57fdef7041509f3e08b98f9b /include/RenderBackend/OpenGL
parente4d073947d09634e95325ddaf8f1615f85e85901 (diff)
Fix double free
Diffstat (limited to 'include/RenderBackend/OpenGL')
-rw-r--r--include/RenderBackend/OpenGL/DeviceFrame.hpp1
-rw-r--r--include/RenderBackend/OpenGL/DeviceMemory.hpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/include/RenderBackend/OpenGL/DeviceFrame.hpp b/include/RenderBackend/OpenGL/DeviceFrame.hpp
index f10af4c..3fa7fe7 100644
--- a/include/RenderBackend/OpenGL/DeviceFrame.hpp
+++ b/include/RenderBackend/OpenGL/DeviceFrame.hpp
@@ -16,6 +16,7 @@ namespace amalgine
DeviceFrame();
~DeviceFrame();
+ // The returned pointers cleaned when the frame is cleaned. Do not deallocate the returned pointer!
DeviceMemory* alloc();
void draw(ShaderProgram *shader);
private:
diff --git a/include/RenderBackend/OpenGL/DeviceMemory.hpp b/include/RenderBackend/OpenGL/DeviceMemory.hpp
index 3e0fede..5f593fc 100644
--- a/include/RenderBackend/OpenGL/DeviceMemory.hpp
+++ b/include/RenderBackend/OpenGL/DeviceMemory.hpp
@@ -35,7 +35,6 @@ namespace amalgine {
TRIANGLE
};
- ~DeviceMemory();
//void copy(const DataView<f32> &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE);
void copy(const DataView<vec2f> &texture_coords, StorageType storageType);
void copy(const DataView<Triangle2D> &triangles, StorageType storageType);
@@ -45,6 +44,7 @@ namespace amalgine {
DeviceMemoryType get_type() const { return type; }
private:
DeviceMemory();
+ ~DeviceMemory();
void use() const;
private:
u32 vertexBufferObjectId;