I want to create an opengGL context using freeglut. First, I determine in what context, checking the supporting version, using glew and some other parameters. I know that to work it needs to work, it needs an opengl context. Therefore, I first create the context using glutCreateWindow, then check the supported version and then install the version required with glutInitContextVersion (), and destroy the previous window with glutDestroyWindow and recreate the new window with glutCreateWindow. I get this error Freeglut error: ERROR: The display callback is not registered for window 1 (I checked 1 - this is the ID for my previous window that I destroyed) . Below is my code
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(900, 600);
int winID = glutCreateWindow("Rotating Cube");
glewExperimental = GL_TRUE;
glewInit();
if (glewIsSupported("GL_VERSION_3_1"))
{
glutInitContextVersion (3, 1);
glutInitContextFlags (GLUT_FORWARD_COMPATIBLE);
}
else if (glewIsSupported("GL_VERSION_2_0"))
{
glutInitContextVersion (2, 0);
}
glutDestroyWindow(winID);
winID = glutCreateWindow("Rotating Cube");
glutSetWindow(winID);
glutDisplayFunc(RenderScene);
glutIdleFunc(RenderScene);
glutReshapeFunc(ChangeSize);
glutKeyboardFunc(ProcessNormalKeys);
glutSpecialFunc(ProcessSpecialKeys);
glutMainLoop();
, , openGL glew. ( , ), . , glutMainLoop. ,
raashimoto destroy
if (g_winID>=0)
{
glutDestroyWindow(g_winID);
g_winID = -1;
}
destroy
ERROR: No display callback registered for window 1
destroy
ERROR: Function <glutSwapBuffers> called with no current window defined.
Display, , . -
, - , ? , - , . glutCloseFunc, , , , glutDestroyWindow