From 8d9b24b1b84107c90a77d94c86a810cc068fe073 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 19 Feb 2020 22:14:12 +0100 Subject: Fix rendering of texture with multiple frames --- include/RenderBackend/OpenGL/DeviceMemory.hpp | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'include/RenderBackend/OpenGL/DeviceMemory.hpp') diff --git a/include/RenderBackend/OpenGL/DeviceMemory.hpp b/include/RenderBackend/OpenGL/DeviceMemory.hpp index 5f593fc..802230d 100644 --- a/include/RenderBackend/OpenGL/DeviceMemory.hpp +++ b/include/RenderBackend/OpenGL/DeviceMemory.hpp @@ -5,6 +5,8 @@ #include "../../Triangle.hpp" #include "../../Vec.hpp" +#include + namespace amalgine { enum class DeviceMemoryType { NONE, @@ -12,11 +14,10 @@ namespace amalgine { VEC3 }; - class DeviceMemory - { + class DeviceMemory { DISABLE_COPY(DeviceMemory) - friend class DeviceFrame; - friend class ShaderProgram; + friend class ShaderFrame; + friend class std::default_delete; public: enum class StorageType { @@ -30,26 +31,20 @@ namespace amalgine { STREAM }; - enum class PrimitiveType - { - TRIANGLE - }; - - //void copy(const DataView &data, StorageType storageType, PrimitiveType primitiveType = PrimitiveType::TRIANGLE); - void copy(const DataView &texture_coords, StorageType storageType); - void copy(const DataView &triangles, StorageType storageType); - void copy(const DataView &triangles, StorageType storageType); - void draw(); + void set(const DataView &texture_coords, StorageType storageType); + void set(const DataView &triangles, StorageType storageType); + void set(const DataView &triangles, StorageType storageType); - DeviceMemoryType get_type() const { return type; } + i32 get_num_vertices() const { return num_vertices; } private: - DeviceMemory(); + DeviceMemory(u32 vertex_array_object_id, i32 attrib_location); ~DeviceMemory(); - void use() const; + void use(); private: - u32 vertexBufferObjectId; - u32 primitiveType; - u32 numVertices; - DeviceMemoryType type; + u32 vertex_array_object_id; + u32 vertex_buffer_object_id; + i32 attrib_location; + i32 num_vertices; + DeviceMemoryType memory_type; }; } -- cgit v1.2.3