14#include <lagrange/ui/api.h>
15#include <lagrange/ui/types/GLContext.h>
31 enum { type = GL_UNSIGNED_INT, integral = 1 };
36 enum { type = GL_INT, integral = 1 };
41 enum { type = GL_UNSIGNED_SHORT, integral = 1 };
46 enum { type = GL_SHORT, integral = 1 };
51 enum { type = GL_UNSIGNED_BYTE, integral = 1 };
56 enum { type = GL_BYTE, integral = 1 };
61 enum { type = GL_DOUBLE, integral = 0 };
66 enum { type = GL_FLOAT, integral = 0 };
79 template <
typename Matrix>
80 void upload(
const Matrix& M);
83 void upload(
const std::vector<T>& arr, uint32_t component_count = 1);
98 upload(GLuint byte_size,
const uint8_t* data, GLsizei count,
bool integral, GLenum gl_type);
100 void download(GLuint size_, uint8_t* data)
const;
106template <
typename Matrix>
107void VertexBuffer::upload(
const Matrix& M)
109 uint32_t component_size =
sizeof(
typename Matrix::Scalar);
111 static_cast<uint32_t
>(M.size()) * component_size,
112 reinterpret_cast<const uint8_t*
>(M.data()),
113 static_cast<GLsizei
>(M.rows()),
120void VertexBuffer::upload(
const std::vector<T>& arr, uint32_t component_count)
122 uint32_t component_size =
sizeof(T);
124 static_cast<uint32_t
>(arr.size()) * component_size,
125 reinterpret_cast<const uint8_t*
>(arr.data()),
126 static_cast<GLsizei
>(arr.size() / component_count),
127 static_cast<bool>(type_traits<T>::integral),
128 static_cast<GLuint
>(type_traits<T>::type));
152 GPUBuffer(GLenum _target = GL_ARRAY_BUFFER)
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Definition: VertexBuffer.h:145
Definition: VertexBuffer.h:133
Definition: VertexBuffer.h:89
Definition: VertexBuffer.h:70
Definition: VertexBuffer.h:27