glfw version output
This commit is contained in:
parent
7be2349442
commit
6f88502cae
4
.github/workflows/appimage-wayland.yml
vendored
4
.github/workflows/appimage-wayland.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: C/C++ AppImage
|
name: C/C++ AppImage (wayland)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
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/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
|
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
|
||||||
- name: configure
|
- name: configure
|
||||||
|
|||||||
@ -6,15 +6,10 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
using glm::vec4;
|
|
||||||
using std::cout;
|
|
||||||
using std::cerr;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
GLFWwindow* Window::window = nullptr;
|
GLFWwindow* Window::window = nullptr;
|
||||||
DisplaySettings* Window::settings = nullptr;
|
DisplaySettings* Window::settings = nullptr;
|
||||||
std::stack<vec4> Window::scissorStack;
|
std::stack<glm::vec4> Window::scissorStack;
|
||||||
vec4 Window::scissorArea;
|
glm::vec4 Window::scissorArea;
|
||||||
uint Window::width = 0;
|
uint Window::width = 0;
|
||||||
uint Window::height = 0;
|
uint Window::height = 0;
|
||||||
int Window::posX = 0;
|
int Window::posX = 0;
|
||||||
@ -97,10 +92,10 @@ const char* glfwErrorName(int error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void error_callback(int error, const char* description) {
|
void error_callback(int error, const char* description) {
|
||||||
cerr << "GLFW error [0x" << std::hex << error << "]: ";
|
std::cerr << "GLFW error [0x" << std::hex << error << "]: ";
|
||||||
cerr << glfwErrorName(error) << endl;
|
std::cerr << glfwErrorName(error) << std::endl;
|
||||||
if (description) {
|
if (description) {
|
||||||
cerr << description << endl;
|
std::cerr << description << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +106,7 @@ int Window::initialize(DisplaySettings& settings){
|
|||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
if (glfwInit() == GLFW_FALSE) {
|
if (glfwInit() == GLFW_FALSE) {
|
||||||
cerr << "Failed to initialize GLFW" << endl;
|
std::cerr << "Failed to initialize GLFW" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +124,7 @@ int Window::initialize(DisplaySettings& settings){
|
|||||||
|
|
||||||
window = glfwCreateWindow(width, height, settings.title.c_str(), nullptr, nullptr);
|
window = glfwCreateWindow(width, height, settings.title.c_str(), nullptr, nullptr);
|
||||||
if (window == nullptr){
|
if (window == nullptr){
|
||||||
cerr << "Failed to create GLFW Window" << endl;
|
std::cerr << "Failed to create GLFW Window" << std::endl;
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -138,8 +133,8 @@ int Window::initialize(DisplaySettings& settings){
|
|||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
GLenum glewErr = glewInit();
|
GLenum glewErr = glewInit();
|
||||||
if (glewErr != GLEW_OK){
|
if (glewErr != GLEW_OK){
|
||||||
cerr << "Failed to initialize GLEW: " << std::endl;
|
std::cerr << "Failed to initialize GLEW: " << std::endl;
|
||||||
cerr << glewGetErrorString(glewErr) << std::endl;
|
std::cerr << glewGetErrorString(glewErr) << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +157,9 @@ int Window::initialize(DisplaySettings& settings){
|
|||||||
glfwSwapInterval(settings.swapInterval);
|
glfwSwapInterval(settings.swapInterval);
|
||||||
const GLubyte* vendor = glGetString(GL_VENDOR);
|
const GLubyte* vendor = glGetString(GL_VENDOR);
|
||||||
const GLubyte* renderer = glGetString(GL_RENDERER);
|
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||||
cout << "GL Vendor: " << (char*)vendor << endl;
|
std::cout << "GL Vendor: " << (char*)vendor << std::endl;
|
||||||
cout << "GL Renderer: " << (char*)renderer << endl;
|
std::cout << "GL Renderer: " << (char*)renderer << std::endl;
|
||||||
|
std::cout << "GLFW: " << glfwGetVersionString() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,12 +202,12 @@ void Window::setCursorMode(int mode){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::resetScissor() {
|
void Window::resetScissor() {
|
||||||
scissorArea = vec4(0.0f, 0.0f, width, height);
|
scissorArea = glm::vec4(0.0f, 0.0f, width, height);
|
||||||
scissorStack = std::stack<vec4>();
|
scissorStack = std::stack<glm::vec4>();
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::pushScissor(vec4 area) {
|
void Window::pushScissor(glm::vec4 area) {
|
||||||
if (scissorStack.empty()) {
|
if (scissorStack.empty()) {
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
@ -241,7 +237,7 @@ void Window::popScissor() {
|
|||||||
std::cerr << "warning: extra Window::popScissor call" << std::endl;
|
std::cerr << "warning: extra Window::popScissor call" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vec4 area = scissorStack.top();
|
glm::vec4 area = scissorStack.top();
|
||||||
scissorStack.pop();
|
scissorStack.pop();
|
||||||
if (area.z < 0.0f || area.w < 0.0f) {
|
if (area.z < 0.0f || area.w < 0.0f) {
|
||||||
glScissor(0, 0, 0, 0);
|
glScissor(0, 0, 0, 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user