You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+---------------------------------------------------+
| _____ /--------------------------\ |
| / \ | | |
| \/\/ | / donut game \ |
| | (o)(o) | | |
| C .---_) \_ _________________________/ |
| | |.___| | / |
| | \__/ <_/ |
| /_____\ |
| /_____/ \ |
| / \ |
+---------------------------------------------------+
hellooooooooooo new york!!!!
Initializing SDL...
SDL Version/Compiled 2.0.12
SDL Version/Linked 2.0.12
OpenGL version loaded: 4.6
Vendor: NVIDIA Corporation
Renderer: GeForce GTX 1050 Ti/PCIe/SSE2
Version: 4.6.0 NVIDIA 460.73.01
// some unrelated messages //
X Error of failed request: GLXBadContext
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 4 (X_GLXDestroyContext)
Serial number of failed request: 3409
Current serial number in output stream: 3409
AL lib: (EE) alc_cleanup: 1 device not closed
Theory: this error is caused by double-free of GL context.
Proof of concept:
#include<GL/glew.h>
#include<SDL2/SDL.h>intmain(int argc, char* argv[])
{
SDL_Init(SDL_INIT_VIDEO); /* Initialises Video Subsystem in SDL *//* Setting up OpenGL version and profile details for context creation */SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
/* A 800x600 window. Pretty! */
SDL_Window* window = SDL_CreateWindow
(
"SDL Context",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
800, 600,
SDL_WINDOW_OPENGL
);
/* Creating OpenGL Context */
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
/* Loading Extensions */
glewExperimental = GL_TRUE;
glewInit();
/* The following code is for error checking. * If OpenGL has initialised properly, this should print 1. * Remove it in production code.*/
GLuint vertex_buffer;
glGenBuffers(1, &vertex_buffer);
printf("%u\n", vertex_buffer);
/* Error checking ends here *//* Main Loop */
SDL_Event window_event;
while(1) {
if (SDL_PollEvent(&window_event)) {
if (window_event.type == SDL_QUIT) {
/* If user is exiting the application */break;
}
}
/* Swap the front and back buffer for flicker-free rendering */SDL_GL_SwapWindow(window);
}
/* Freeing Memory */glDeleteBuffers(1, &vertex_buffer);
SDL_GL_DeleteContext(gl_context);
SDL_GL_DeleteContext(gl_context); // <=SDL_Quit();
return0;
}
X Error of failed request: GLXBadContext
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 4 (X_GLXDestroyContext)
Serial number of failed request: 299
Current serial number in output stream: 299
The text was updated successfully, but these errors were encountered:
Problem: donut always exits ungracefully.
Theory: this error is caused by double-free of GL context.
Proof of concept:
The text was updated successfully, but these errors were encountered: