-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buffers.h
87 lines (67 loc) · 1.66 KB
/
Buffers.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
84
85
86
87
//
// Buffers.h
//
// Vertex and element buffer management
//
// Author: Warren R. Carithers
// Date: 2017/02/11 22:34:54
//
#ifndef _BUFFERS_H_
#define _BUFFERS_H_
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif
#ifndef __APPLE__
#include <GL/glew.h>
#endif
#include <GLFW/glfw3.h>
using namespace std;
#include "Canvas.h"
///
// All the relevant information needed to keep
// track of vertex and element buffers
///
class BufferSet {
public:
// buffer handles
GLuint vbuffer, ebuffer;
// total number of vertices
int numElements;
// component sizes (bytes)
long vSize, eSize, tSize, cSize, nSize;
// have these already been set up?
bool bufferInit;
public:
///
// Constructor
///
BufferSet( void );
///
// initBuffer(buf) - reset the BufferSet to its "empty" state
///
void initBuffer( void );
///
// dumpBuffer(buf) - dump the contents of the BufferSet
//
// @param which - description of the buffer
///
void dumpBuffer( const char *which );
///
// makeBuffer(target,data,size) - make a vertex or element array buffer
//
// @param target - which type of buffer to create
// @param data - source of data for buffer (or NULL)
// @param size - desired length of buffer
//
// @return the ID of the new buffer
///
GLuint makeBuffer( GLenum target, const void *data, GLsizeiptr size );
///
// createBuffers(buf,canvas) - create a set of buffers for the object
// currently held in 'canvas'.
//
// @param C - the Canvas we'll use for drawing
///
void createBuffers( Canvas &C );
};
#endif