-
Notifications
You must be signed in to change notification settings - Fork 0
/
VertexBufferObject.h
50 lines (40 loc) · 1.22 KB
/
VertexBufferObject.h
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
42
43
44
45
46
47
48
49
50
#ifndef VBO_H
#define VBO_H
#include <iostream>
#include <GL/glew.h>
#include "Mathlib.h"
#include <vector>
class VertexBufferObject
{
public:
bool Create(GLenum usage);
void Destroy();
// Activation et désactivation du VB
void Enable();
void Disable();
// Buffers de données
inline std::vector<vec3>& getPosition() {return m_tDataPosition;}
inline std::vector<vec3>& getNormal() {return m_tDataNormal;}
inline std::vector<vec2>& getTexcoord() {return m_tDataTexcoord;}
inline std::vector<vec3>& getTangent() {return m_tDataTangent;}
VertexBufferObject();
~VertexBufferObject() {Destroy();}
private:
void Enable_VA(); // Activation en Vertex Array
void Enable_VBO(); // Activation en Vertex Buffer Object
void Disable_VA(); // Désactivation en Vertex Array
void Disable_VBO(); // Désactivation en Vertex Buffer Object
private:
// Identifiants pour le VBO
GLuint m_nVBOid;
GLintptr m_nVBO_OffsetPosition;
GLintptr m_nVBO_OffsetNormal;
GLintptr m_nVBO_OffsetTexcoord;
GLintptr m_nVBO_OffsetTangent;
// Données :
std::vector<vec3> m_tDataPosition;
std::vector<vec3> m_tDataNormal;
std::vector<vec2> m_tDataTexcoord;
std::vector<vec3> m_tDataTangent;
};
#endif