-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.c
48 lines (37 loc) · 1.09 KB
/
gui.c
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
//
// Created by Afterwind on 10/15/2017.
//
#include <GL/glew.h>
#include <stdio.h>
#include "gui.h"
#include "shader.h"
/* EXTERNAL FUNCTIONS */
void initGUI() {
geGUIElements[0].x = 1;
geGUIElements[0].y = 1;
geGUIElements[1].x = -1;
geGUIElements[1].y = 1;
geGUIElements[2].x = 1;
geGUIElements[2].y = -1;
geGUIElements[3].x = -1;
geGUIElements[3].y = -1;
glUseProgram(programs[GE_PROGRAM_GUI]);
glGenBuffers(1, &vboGUI);
glGenVertexArrays(1, &vaoGUI);
glBindBuffer(GL_ARRAY_BUFFER, vboGUI);
glBufferData(GL_ARRAY_BUFFER, sizeof(geGUIElements[0]) * 4, geGUIElements, GL_STATIC_DRAW);
glBindVertexArray(vaoGUI);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
printf("%s\n", gluErrorString(err));
}
}
void drawGUI() {
glUseProgram(programs[GE_PROGRAM_GUI]);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, vboGUI);
glBindVertexArray(vaoGUI);
// glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}