SDL删除GL上下文内存安全

时间:2014-12-07 07:12:21

标签: c++ opengl sdl

如果我通过SDL获取OpenGL上下文

SDL_GLContext* SetupOpenGL(SDL_Window *wnd) {
    SDL_GLContext *context;

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

    assert(wnd != 0);
    *context = SDL_GL_CreateContext(wnd);

    return context;
}

是否可以在退出时释放SDL_GLContext SDL_GL_Deletecontext,或者我还需要做其他事情吗?

0 个答案:

没有答案