2016-03-21 51 views
2

我想知道如果我删除sdl和opengl正确的方式。我是否删除sdl2和opengl正确的C++

这里是我的解构的代码:

Mix_CloseAudio(); 

// Close and destroy the window 
SDL_DestroyWindow(window); 
SDL_GL_DeleteContext(gContext); 

// Clean up 
SDL_Quit(); 

glDeleteProgram(programID); 
glDeleteTextures(1, &textureID); 

回答

2

不,这是几乎完全倒退。

SDL窗口拥有GL上下文,并且GL上下文拥有GL对象。

你想是这样的:

Mix_CloseAudio(); 

glDeleteProgram(programID); 
glDeleteTextures(1, &textureID); 

SDL_GL_DeleteContext(gContext); 

// Close and destroy the window 
SDL_DestroyWindow(window); 

// Clean up 
SDL_Quit();