Josh's Graphics Library
VRamList.h
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <glad/glad.h>
4#include <J3ML/LinearAlgebra/Vector2.hpp>
5#include <J3ML/LinearAlgebra/Vector2i.hpp>
6#include <J3ML/LinearAlgebra/Vector3.hpp>
7#include <J3ML/LinearAlgebra/Vector4.hpp>
8
9namespace JGL {
10 class VRamList;
11}
12
15private:
16 GLuint list_handle = 0;
17 long num_elements = 0;
18 bool element_array_buffer = false;
19 void load(const GLfloat* data, const long& size);
20 void load(const GLuint* data, const long& size);
21 void SetData(void* data, const long& length);
22 void UpdateData(void* data, const long& offset, const long& length);
23 void Erase();
24public:
25 VRamList(const GLuint* data, const long& length);
26 VRamList(const GLfloat* data, const long& length);
27 VRamList(const Vector2* data, const long& length);
28 VRamList(const Vector3* data, const long& length);
29 VRamList(const Vector4* data, const long& length);
30
31 ~VRamList();
34 VRamList(const VRamList& rhs);
35 VRamList() = default;
36public:
37 [[nodiscard]] GLuint GetHandle() const;
39 [[nodiscard]] long GetLength() const;
41 [[nodiscard]] size_t GetSize() const;
44 [[nodiscard]] std::vector<GLfloat> GetDataF() const;
45 [[nodiscard]] std::vector<GLuint> GetDataUI() const;
46 [[nodiscard]] bool IsFloatArray() const;
49 void SetData(const GLfloat* data, const long& length);
50 void SetData(const Vector2* data, const long& length);
51 void SetData(const Vector3* data, const long& length);
52 void SetData(const Vector4* data, const long& length);
53
54 void SetData(const GLuint* data, const long& length);
55 void SetData(const Vector2i* data, const long& length);
56
61 void UpdateData(const GLfloat* data, const long& offset, const long& length);
62 void UpdateData(const Vector2* data, const long& offset, const long& length);
63 void UpdateData(const Vector3* data, const long& offset, const long& length);
64 void UpdateData(const Vector4* data, const long& offset, const long& length);
65
66 void UpdateData(const GLuint* data, const long& offset, const long& length);
67 void UpdateData(const Vector2i* data, const long& offset, const long& length);
68};
A wrapped for "Vertex Buffer Object" In OpenGL, Store things in VRam.
Definition: VRamList.h:14
bool IsFloatArray() const
Definition: VRamList.cpp:50
std::vector< GLuint > GetDataUI() const
Definition: VRamList.cpp:165
long GetLength() const
Returns the number of elements in the list.
Definition: VRamList.cpp:54
GLuint GetHandle() const
Definition: VRamList.cpp:46
~VRamList()
Definition: VRamList.cpp:255
VRamList()=default
std::vector< GLfloat > GetDataF() const
Get VBO data back from the GPU.
Definition: VRamList.cpp:144
size_t GetSize() const
Returns the size of the data in bytes.
Definition: VRamList.cpp:58
OpenGL Wrapper for rendering 2D & 3D graphics in both a 2D and 3D context.
Definition: JGL.h:31