Skip to content

Instantly share code, notes, and snippets.

@Spotlight0xff
Last active January 23, 2018 23:59
Show Gist options
  • Save Spotlight0xff/84ed0220e7254893db0e20cc740c61fe to your computer and use it in GitHub Desktop.
Save Spotlight0xff/84ed0220e7254893db0e20cc740c61fe to your computer and use it in GitHub Desktop.
Minimal reproducible bug (GLFW wayland)
#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