-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuffer.h
83 lines (60 loc) · 3.39 KB
/
buffer.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <GL/gl.h>
#include <glm/glm.hpp>
#pragma once
namespace EZGraphics {
/* ------------------------------------------- */
typedef enum { Array, ElemArray } BufType;
/* ------------------------------------------- */
class Buffer {
private:
GLuint handle;
BufType tp;
GLenum type;
int components;
public:
Buffer ( const Buffer &a );
Buffer ( const int cs, const int size, const GLubyte * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLbyte * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLuint * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLint * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLshort * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLushort * const data = NULL, const BufType t = Array );
Buffer ( const int cs, const int size, const GLfloat * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLubyte * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLbyte * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLshort * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLushort * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLint * const data, const BufType t = Array );
Buffer ( const int size, const glm::ivec2 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::ivec3 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::ivec4 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLuint * const data, const BufType t = Array );
Buffer ( const int size, const glm::uvec2 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::uvec3 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::uvec4 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const GLfloat * const data, const BufType t = Array );
Buffer ( const int size, const glm::vec2 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::vec3 * const data = NULL, const BufType t = Array );
Buffer ( const int size, const glm::vec4 * const data = NULL, const BufType t = Array );
~Buffer();
Buffer & operator= ( const Buffer & rhs );
void setIndex ( int aix ) const;
void on();
void off();
GLenum getType() const { return type; }
GLuint getHandle() const { return handle; }
// void useAsShaderStorage ( GLuint index );
};
/* ------------------------------------------- */
class IndexBuffer : public Buffer {
public:
IndexBuffer ( const int size, const GLubyte * const data = NULL );
IndexBuffer ( const int size, const GLuint * const data = NULL );
IndexBuffer ( const int size, const GLushort * const data = NULL );
IndexBuffer ( const int size, const glm::uvec2 * const data = NULL );
IndexBuffer ( const int size, const glm::uvec3 * const data = NULL );
IndexBuffer ( const IndexBuffer & );
IndexBuffer & operator= ( const IndexBuffer & );
};
/* ------------------------------------------- */
};