diff options
Diffstat (limited to 'yage/core/window.cpp')
-rw-r--r-- | yage/core/window.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/yage/core/window.cpp b/yage/core/window.cpp index 711e1294..c55b1ad1 100644 --- a/yage/core/window.cpp +++ b/yage/core/window.cpp @@ -9,8 +9,8 @@ #include "window.h" #include "../data/input.h" -#include <glad/glad.h> #include <GLFW/glfw3.h> +#include <glad/glad.h> #include <stdexcept> @@ -19,7 +19,8 @@ using std::runtime_error; namespace yage { -namespace { +namespace +{ void key_callback(GLFWwindow *window, int key, int scanCode, int action, int mods) @@ -38,15 +39,10 @@ Window::Window() = default; Window::~Window() { glfwDestroyWindow(window_); - glfwTerminate(); } void Window::create(std::string window_name, int width, int height) { - if (glfwInit() == GLFW_FALSE) { - throw runtime_error("GLFW Initialisation failed"); - } - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); @@ -71,13 +67,9 @@ void Window::create(std::string window_name, int width, int height) // set vsync on glfwSwapInterval(1); - // set the clear colour to black - glClearColor(0.18f, 0.18f, 0.18f, 1.f); // set alpha blending glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // set the clear depth - glClearDepth(1.f); } void Window::swapBuffer() @@ -88,6 +80,10 @@ void Window::swapBuffer() void Window::clearBuffer() { + // set the clear colour to black + glClearColor(0.18f, 0.18f, 0.18f, 1.f); + // set the clear depth + glClearDepth(1.f); // clears buffer with clear colour glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } |