Hi,
I do some C++ programming on my leisure time. I have been working on a flight sim project for nearly two years with glfw and glad on windows 7. I recently had a problem with my PC and I had to move from windows 7 to windows 10. I reinstalled code::blocks and recompile my project.
My program starts and runs for a few seconds or minutes, then the glfw window randomly crashes and my program terminates without any error code or text. It never happened before with windows 7.
I downloaded glfw-3.3.6 binaries for win64 and also updated glad. It didn’t help.
Any advice ? where to start ?
Here is my initialisation code, if it may help :
"…
void MyGLFWerror(int code, const char* text)
{
cout << "Erreur GLFW " << code << ", " << text << endl;
}
int main()
{
// initialisation du generateur aleatoire
srand(time(nullptr));
glfwSetErrorCallback(MyGLFWerror);
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// glfw window creation
// --------------------
GLFWwindow* window;
GLFWmonitor *monitor=glfwGetPrimaryMonitor();
#if FULL_SCREEN
glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
glfwWindowHint(GLFW_REFRESH_RATE, 60);
window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Simu_V11", monitor, NULL);
#else
window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Simu_V11", NULL, NULL);
#endif
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwSetCursorPos(window,static_cast<float>(SCR_WIDTH)/2.0f, static_cast<float>(SCR_HEIGHT)/2.0f);
// glad: load all OpenGL function pointers
// ---------------------------------------
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
…"