-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenGLWrapper.cpp
More file actions
56 lines (39 loc) · 1.04 KB
/
Copy pathOpenGLWrapper.cpp
File metadata and controls
56 lines (39 loc) · 1.04 KB
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
#include "OpenGLWrapper.h"
#include <stdlib.h>
GLFWwindow* OpenGLWrapper::window;
unsigned int OpenGLWrapper::width;
unsigned int OpenGLWrapper::height;
char* OpenGLWrapper::title;
void OpenGLWrapper::makePix(int x, int y){
}
//initializes library and opens a window
void OpenGLWrapper::init(){
/* Initialize the library */
if (!glfwInit())
exit(EXIT_FAILURE);
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(width, height, title, NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
}
//keep the program alive as long as the window is
void OpenGLWrapper::hold(){
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
}
//terminate library
void OpenGLWrapper::terminate(){
glfwTerminate();
}