SimpleGL  1.1.0
A framework for platform independent rendering
core.cpp
Go to the documentation of this file.
1 
8 #include "SimpleGL/core.hpp"
9 
10 #include <cstdlib>
11 
12 #include <GLFW/glfw3.h>
13 
16 #include "SimpleGL/logging.hpp"
17 
18 namespace sgl {
19 
20  void init() {
21  /* Setup GLFW error callback */
22  ErrorCallback* errorCallback = new ErrorCallback();
23  GLFW::setErrorCallback(errorCallback);
24 
25  /* Initialize GLFW */
26  Logger::logInfo("Initializing GLFW...");
27  if (!glfwInit()) {
28  Logger::logError("Could not init GLFW!");
29  exit(EXIT_FAILURE);
30  }
31 
32  Logger::logInfo("Initialization was successful.");
33  }
34 }
static void logInfo(std::string message)
Logs an information string to cout.
Definition: logging.cpp:20
static void logError(std::string message)
Logs an error string to cerr.
Definition: logging.cpp:24
This class wraps a GLFW error callback.
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
SIMPLEGL_EXPORT void init()
Initializes SimpleGL and should be called before anything else.
Definition: core.cpp:20
static void setErrorCallback(ErrorCallback *callback)
Set the error callback.