-
Notifications
You must be signed in to change notification settings - Fork 0
/
gl_framework.hpp
56 lines (44 loc) · 1019 Bytes
/
gl_framework.hpp
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
#ifndef _GL_FRAMEWORK_HPP_
#define _GL_FRAMEWORK_HPP_
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <vector>
#include <string>
#include <iostream>
#include <math.h>
#include <signal.h>//GLCAll()
#define ASSERT(x) if(!(x)) raise(SIGTRAP);
#define GLCall(x) GLClearError();\
x;\
ASSERT(GLLogCall(#x, __FILE__, __LINE__))
static void GLClearError()
{
while(glGetError() != GL_NO_ERROR);
}
static bool GLLogCall(const char* function, const char* file, int line)
{
while(GLenum error = glGetError())
{
std::cout << "[OpenGL Error](" <<error<< "): " << function << " " << file << ":" << line << std::endl;
return false;
}
return true;
}
namespace opengl
{
//! Initialize GL State
void initGL(void);
//!GLFW Error Callback
void error_callback(int error, const char* description);
};
struct Vertex
{
glm::vec3 position;
glm::vec2 texcoord;
glm::vec3 normal;
glm::vec3 tangent;
};
#endif