aboutsummaryrefslogtreecommitdiff
path: root/apps/openmb/renderer/Mesh.hpp
blob: de0a8fa4c5c4fab5d0cad261aab64081c45370a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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