-
Notifications
You must be signed in to change notification settings - Fork 0
/
testOGLShaderManager.cpp
56 lines (42 loc) · 1.21 KB
/
testOGLShaderManager.cpp
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 <iostream>
#include <stdexcept>
#include <GL/glew.h>
#include <GL/glfw.h>
#include "OGLShaderManager.hpp"
void init_OpenGL()
{
// initialize glfw
if (!glfwInit()) {
throw std::runtime_error("Couldn't initialize glfw");
}
// open a window and create its opengl context
if (!glfwOpenWindow(10, 10, 0, 0, 0, 0, 32, 0, GLFW_WINDOW)) {
fprintf(stderr, "Failed to open GLFW window\n");
glfwTerminate();
}
// initialize GLEW
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) {
throw std::runtime_error("Couldn't initialize GLEW");
}
glfwSetWindowTitle("Particle Simulation");
// initialize GL
glClearColor(0.0f, 0.0f, 0.1f, 0.0f);
glDisable(GL_DEPTH_TEST);
}
int main(int argc, char const *argv[])
{
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <shader_dir>" << std::endl;
exit(1);
}
init_OpenGL();
// using the SHARED_MGR
OGLShaderManager::SHARED_MGR.add_directory(argv[1]);
OGLShaderManager::SHARED_MGR.print_program_ids();
// using an instanced manager
//OGLShaderManager ogl_smgr;
//ogl_smgr.add_directory(argv[1]);
//ogl_smgr.print_program_ids();
return 0;
}