Repository navigation
Expand file tree
/
Copy pathExceptions.h
More file actions
55 lines (43 loc) · 1.83 KB
/
Copy pathExceptions.h
File metadata and controls
55 lines (43 loc) · 1.83 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
// +------------------------------------------------------------+
// | University Racer |
// | Projekt do PGR a GMU, FIT VUT v Brne, 2011 |
// +------------------------------------------------------------+
// | Autori: Tomáš Kimer, xkimer00@stud.fit.vutbr.cz |
// | Tomáš Sychra, xsychr03@stud.fit.vutbr.cz |
// | David Šabata, xsabat01@stud.fit.vutbr.cz |
// +------------------------------------------------------------+
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <exception>
#include <stdexcept>
#include <string>
#include <SDL/SDL.h>
#ifdef USE_GLEE
# include <GL/GLee.h>
#else
# include <GL/glew.h>
#endif
#include "Debug.h"
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Exception classes
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Replacement for gluErrorString
const char * getGlErrorString(GLenum error);
struct SDL_Exception : public std::runtime_error
{
SDL_Exception() throw() : std::runtime_error(std::string("SDL : ") + SDL_GetError()) {}
};
struct GL_Exception : public std::runtime_error
{
GL_Exception(const GLenum error = glGetError()) throw()
: std::runtime_error(std::string("OpenGL : ") + (const char*)getGlErrorString(error)) {}
GL_Exception(const char * text, const GLenum error = glGetError()) throw()
: std::runtime_error(std::string("OpenGL : ") + text + " - " + (const char*)getGlErrorString(error)) {}
};
struct String_Exception : public std::runtime_error
{
String_Exception(std::string message) throw() : std::runtime_error(message) {}
};
#endif