diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /apps/openmb/renderer/Mesh.hpp | |
Diffstat (limited to 'apps/openmb/renderer/Mesh.hpp')
| -rw-r--r-- | apps/openmb/renderer/Mesh.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/openmb/renderer/Mesh.hpp b/apps/openmb/renderer/Mesh.hpp new file mode 100644 index 0000000..de0a8fa --- /dev/null +++ b/apps/openmb/renderer/Mesh.hpp @@ -0,0 +1,41 @@ +#pragma once + +#ifdef __APPLE__ +#include <OpenGL/gl3.h> +#else +#define GLFW_INCLUDE_NONE +#include <GLFW/glfw3.h> +#ifdef __APPLE__ +#include <OpenGL/gl3.h> +#endif +#endif +#include <vector> + +namespace renderer +{ + class Mesh + { + public: + Mesh(); + ~Mesh(); + + bool createFromPositions( const std::vector< float > &positions, bool lines = false ); + + bool createFromPosTex( const std::vector< float > &data ); + + bool createFromPosTexNormal( const std::vector< float > &data ); + bool createFromPosTexNormalIndexed( const std::vector< float > &data, + const std::vector< unsigned int > &indices ); + + void draw() const; + + private: + GLuint mVAO; + GLuint mVBO; + GLuint mEBO; + GLsizei mVertexCount; + GLsizei mIndexCount; + GLenum mMode; + }; + +} // namespace renderer |