Last active
January 23, 2018 23:59
-
-
Save Spotlight0xff/84ed0220e7254893db0e20cc740c61fe to your computer and use it in GitHub Desktop.
Minimal reproducible bug (GLFW wayland)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <GLFW/glfw3.h> | |
int main() { | |
if (!glfwInit()) { | |
std::cerr << "Unable to initialize GLFW" << std::endl; | |
return -1; | |
} | |
GLFWwindow* mWindow = glfwCreateWindow(800, 600, "glfw wayland bug", nullptr, nullptr); | |
if (!mWindow) { | |
std::cerr << "Unable to create a GLFW window" << std::endl; | |
glfwTerminate(); | |
return -2; | |
} | |
glfwMakeContextCurrent(mWindow); | |
// this code has been added to demonstrate the bug | |
// in the actual code, there was a need to recreate the window | |
// using a different OpenGL version/context. | |
{ | |
glfwDestroyWindow(mWindow); | |
// lets try again | |
mWindow = glfwCreateWindow(800, 600, "glfw wayland bug #2", nullptr, nullptr); | |
if (!mWindow) { | |
glfwTerminate(); | |
return -3; | |
} | |
glfwMakeContextCurrent(mWindow); | |
} | |
while (!glfwWindowShouldClose(mWindow)) { | |
glfwPollEvents(); | |
} | |
glfwTerminate(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment