-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCube.cpp
More file actions
39 lines (31 loc) · 671 Bytes
/
Cube.cpp
File metadata and controls
39 lines (31 loc) · 671 Bytes
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
#include "Cube.h"
#include "GLWindow.h"
namespace Cube
{
static unsigned cubevbo, cubeabo;
static const signed char cube[] =
{
-1, -1, -1, 0, 0, -128,
1, -1, -1, 0, 0, -128,
1, 1, -1, 0, 0, -128,
1, -1, -1, 0, 0, -128,
1, 1, -1, 0, 0, -128,
-1, 1, -1, 0, 0, -128,
};
void Init()
{
glGenBuffers(1, &quadvbo);
glBindBuffer(GL_ARRAY_BUFFER, cubevbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(char) * 8 * 3, quad, GL_STATIC_DRAW);
}
void Draw()
{
glBindBuffer(GL_ARRAY_BUFFER, quadvbo);
glVertexAttribPointer(0, 2, GL_BYTE, GL_FALSE, 0, (void*)0);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
void Kill()
{
glDeleteBuffers(1, &quadvbo);
}
}