Simplify mesh class

This commit is contained in:
David Allemang
2022-02-16 22:19:03 -05:00
parent 89b9780f6c
commit 22976a9778
6 changed files with 139 additions and 237 deletions

View File

@@ -41,6 +41,11 @@ public:
return count;
}
template<typename T>
GLuint upload(const T& data, GLenum mode = GL_STATIC_DRAW) {
return upload(data.begin(), data.end(), mode);
}
~Buffer() {
// delete silently ignores 0.
glDeleteBuffers(1, &id);

View File

@@ -4,7 +4,7 @@
#include <Eigen/Eigen>
template<class T_>
template<typename T_>
struct Buffer;
template<class ...Fmt_>
@@ -66,18 +66,23 @@ struct AutoFormat {
};
template<>
struct AutoFormat<double> {
using Fmt = LFormat<double, GL_DOUBLE, 1>;
struct AutoFormat<GLdouble> {
using Fmt = LFormat<GLdouble, GL_DOUBLE, 1>;
};
template<>
struct AutoFormat<float> {
using Fmt = Format<float, GL_FLOAT, 1>;
struct AutoFormat<GLfloat> {
using Fmt = Format<GLfloat, GL_FLOAT, 1>;
};
template<>
struct AutoFormat<int> {
using Fmt = IFormat<int, GL_INT, 1>;
struct AutoFormat<GLint> {
using Fmt = IFormat<GLint, GL_INT, 1>;
};
template<>
struct AutoFormat<GLuint> {
using Fmt = IFormat<GLuint, GL_UNSIGNED_INT, 1>;
};
template<typename Scalar, int Dim>