Reputation: 67
I was wondering if i am deleting sdl and opengl the right way.
Here is the code of my deconstructor:
Mix_CloseAudio();
// Close and destroy the window
SDL_DestroyWindow(window);
SDL_GL_DeleteContext(gContext);
// Clean up
SDL_Quit();
glDeleteProgram(programID);
glDeleteTextures(1, &textureID);
Upvotes: 2
Views: 203
Reputation: 52082
Nope, that's almost exactly backwards.
The SDL window owns the GL context, and the GL context owns the GL objects.
You want something like this:
Mix_CloseAudio();
glDeleteProgram(programID);
glDeleteTextures(1, &textureID);
SDL_GL_DeleteContext(gContext);
// Close and destroy the window
SDL_DestroyWindow(window);
// Clean up
SDL_Quit();
Upvotes: 2