-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtil.cpp
More file actions
29 lines (23 loc) · 727 Bytes
/
Util.cpp
File metadata and controls
29 lines (23 loc) · 727 Bytes
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
#include <GL/glew.h>
#include <iostream>
#include "Util.h"
std::string readFile(const std::string& fileName) {
std::ifstream in(fileName);
if (!in) {
throw GraphicsException("Unable to open: " + fileName);
}
std::string lines = "";
std::string line;
while (std::getline(in, line)) {
lines += line;
lines += "\n";
}
return lines;
}
void loggingCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
std::cerr << "OpenGL: " << message << std::endl;
}
GraphicsException::GraphicsException(const std::string& msg) : m_msg(msg) {}
const char* GraphicsException::what() const noexcept {
return m_msg.c_str();
}