From 6f88502cae543ae652dcd600871a46a9a9522901 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 18 Feb 2024 19:25:48 +0300 Subject: [PATCH] glfw version output --- .github/workflows/appimage-wayland.yml | 4 +-- src/window/Window.cpp | 36 ++++++++++++-------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/appimage-wayland.yml b/.github/workflows/appimage-wayland.yml index 9bc55cc0..f59902f7 100644 --- a/.github/workflows/appimage-wayland.yml +++ b/.github/workflows/appimage-wayland.yml @@ -1,4 +1,4 @@ -name: C/C++ AppImage +name: C/C++ AppImage (wayland) on: push: @@ -23,7 +23,7 @@ jobs: - name: install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential libglfw3-dev libglfw3-wayland libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev cmake squashfs-tools + sudo apt-get install -y build-essential libglfw3-wayland libglfw3-dev libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev cmake squashfs-tools sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a sudo ln -s /usr/include/luajit-2.1 /usr/include/lua - name: configure diff --git a/src/window/Window.cpp b/src/window/Window.cpp index b18405ae..e05b6b3b 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -6,15 +6,10 @@ #include #include -using glm::vec4; -using std::cout; -using std::cerr; -using std::endl; - GLFWwindow* Window::window = nullptr; DisplaySettings* Window::settings = nullptr; -std::stack Window::scissorStack; -vec4 Window::scissorArea; +std::stack Window::scissorStack; +glm::vec4 Window::scissorArea; uint Window::width = 0; uint Window::height = 0; int Window::posX = 0; @@ -97,10 +92,10 @@ const char* glfwErrorName(int error) { } void error_callback(int error, const char* description) { - cerr << "GLFW error [0x" << std::hex << error << "]: "; - cerr << glfwErrorName(error) << endl; + std::cerr << "GLFW error [0x" << std::hex << error << "]: "; + std::cerr << glfwErrorName(error) << std::endl; if (description) { - cerr << description << endl; + std::cerr << description << std::endl; } } @@ -111,7 +106,7 @@ int Window::initialize(DisplaySettings& settings){ glfwSetErrorCallback(error_callback); if (glfwInit() == GLFW_FALSE) { - cerr << "Failed to initialize GLFW" << endl; + std::cerr << "Failed to initialize GLFW" << std::endl; return -1; } @@ -129,7 +124,7 @@ int Window::initialize(DisplaySettings& settings){ window = glfwCreateWindow(width, height, settings.title.c_str(), nullptr, nullptr); if (window == nullptr){ - cerr << "Failed to create GLFW Window" << endl; + std::cerr << "Failed to create GLFW Window" << std::endl; glfwTerminate(); return -1; } @@ -138,8 +133,8 @@ int Window::initialize(DisplaySettings& settings){ glewExperimental = GL_TRUE; GLenum glewErr = glewInit(); if (glewErr != GLEW_OK){ - cerr << "Failed to initialize GLEW: " << std::endl; - cerr << glewGetErrorString(glewErr) << std::endl; + std::cerr << "Failed to initialize GLEW: " << std::endl; + std::cerr << glewGetErrorString(glewErr) << std::endl; return -1; } @@ -162,8 +157,9 @@ int Window::initialize(DisplaySettings& settings){ glfwSwapInterval(settings.swapInterval); const GLubyte* vendor = glGetString(GL_VENDOR); const GLubyte* renderer = glGetString(GL_RENDERER); - cout << "GL Vendor: " << (char*)vendor << endl; - cout << "GL Renderer: " << (char*)renderer << endl; + std::cout << "GL Vendor: " << (char*)vendor << std::endl; + std::cout << "GL Renderer: " << (char*)renderer << std::endl; + std::cout << "GLFW: " << glfwGetVersionString() << std::endl; return 0; } @@ -206,12 +202,12 @@ void Window::setCursorMode(int mode){ } void Window::resetScissor() { - scissorArea = vec4(0.0f, 0.0f, width, height); - scissorStack = std::stack(); + scissorArea = glm::vec4(0.0f, 0.0f, width, height); + scissorStack = std::stack(); glDisable(GL_SCISSOR_TEST); } -void Window::pushScissor(vec4 area) { +void Window::pushScissor(glm::vec4 area) { if (scissorStack.empty()) { glEnable(GL_SCISSOR_TEST); } @@ -241,7 +237,7 @@ void Window::popScissor() { std::cerr << "warning: extra Window::popScissor call" << std::endl; return; } - vec4 area = scissorStack.top(); + glm::vec4 area = scissorStack.top(); scissorStack.pop(); if (area.z < 0.0f || area.w < 0.0f) { glScissor(0, 0, 0, 0);