aboutsummaryrefslogtreecommitdiffstats
path: root/yage/base/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yage/base/window.cpp')
-rw-r--r--yage/base/window.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/yage/base/window.cpp b/yage/base/window.cpp
index 67f32bb2..38056b14 100644
--- a/yage/base/window.cpp
+++ b/yage/base/window.cpp
@@ -8,7 +8,6 @@
#include "window.h"
-#include <iostream>
#include <stdexcept>
namespace yage
@@ -22,12 +21,13 @@ Window::~Window()
}
void Window::create(const std::string &window_name, int width, int height,
- unsigned flags)
+ unsigned)
{
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
- window_ = glfwCreateWindow(width, height, window_name.c_str(), nullptr, nullptr);
+ window_ =
+ glfwCreateWindow(width, height, window_name.c_str(), nullptr, nullptr);
if (window_ == nullptr) {
throw std::runtime_error("GLFW Window creation failed");
}
@@ -35,9 +35,8 @@ void Window::create(const std::string &window_name, int width, int height,
// initialize the gl context
glfwMakeContextCurrent(window_);
- // print out the current OpenGL version to debug
- std::cout << "*** OpenGL version: " << glGetString(GL_VERSION)
- << " ***\n";
+ // initialize glad
+ gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
// set vsync on
glfwSwapInterval(1);
@@ -63,4 +62,14 @@ void Window::clearBuffer()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
+void Window::hide()
+{
+ glfwHideWindow(window_);
+}
+
+void Window::show()
+{
+ glfwShowWindow(window_);
+}
+
} // namespace yage