From 44f5ac32a68a617f93704d44c4339f7db13b323e Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 15 Dec 2018 23:09:32 +0100 Subject: Hacky D2Q9 BGK LBM on GPU using GLSL compute shaders Improvised on top of computicles's scaffolding. Works in a world where _works_ is defined as "displays stuff on screen that invokes thoughts of fluid movement". --- src/glfw/window.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/glfw/window.cc (limited to 'src/glfw/window.cc') diff --git a/src/glfw/window.cc b/src/glfw/window.cc new file mode 100644 index 0000000..0e57a65 --- /dev/null +++ b/src/glfw/window.cc @@ -0,0 +1,32 @@ +#include "window.h" + +Window::Window(const std::string& title): + _handle(glfwCreateWindow(_width, _height, title.c_str(), NULL, NULL)) { + if ( _handle != nullptr ) { + glfwMakeContextCurrent(_handle); + if ( glewInit() == GLEW_OK ) { + _good = true; + } + glfwMakeContextCurrent(nullptr); + } +} + +Window::~Window() { + glfwDestroyWindow(_handle); +} + +bool Window::isGood() const { + return _good; +} + +int Window::getWidth() const { + return _width; +} + +int Window::getHeight() const { + return _height; +} + +KeyWatcher Window::getKeyWatcher(int key) { + return KeyWatcher(_handle, key); +} -- cgit v1.2.3