src/glcontext.c

changeset 93
52611a99e574
parent 92
78ce93fb46e5
equal deleted inserted replaced
92:78ce93fb46e5 93:52611a99e574
136 if (asc_texture_initialize_predefined(ctx)) { 136 if (asc_texture_initialize_predefined(ctx)) {
137 asc_error("Initializing predefined textures failed"); 137 asc_error("Initializing predefined textures failed");
138 return false; 138 return false;
139 } 139 }
140 140
141 ctx->mpool = cxMempoolCreateSimple(128);
142
141 return true; 143 return true;
142 } else { 144 } else {
143 asc_error("glewInit failed: %s", glewGetErrorString(err)); 145 asc_error("glewInit failed: %s", glewGetErrorString(err));
144 SDL_GL_DeleteContext(ctx->glctx); 146 SDL_GL_DeleteContext(ctx->glctx);
145 return false; 147 return false;
148 150
149 void asc_gl_context_destroy(AscGLContext *ctx) { 151 void asc_gl_context_destroy(AscGLContext *ctx) {
150 if (ctx->glctx == NULL) return; 152 if (ctx->glctx == NULL) return;
151 SDL_GL_MakeCurrent(ctx->window, ctx->glctx); 153 SDL_GL_MakeCurrent(ctx->window, ctx->glctx);
152 154
155 cxMempoolFree(ctx->mpool);
156 ctx->mpool = NULL;
153 asc_texture_destroy_predefined(ctx); 157 asc_texture_destroy_predefined(ctx);
154 asc_shader_destroy_predefined(ctx); 158 asc_shader_destroy_predefined(ctx);
155 asc_primitives_destroy(ctx); 159 asc_primitives_destroy(ctx);
156 160
157 // destroy the GL context and the window 161 // destroy the GL context and the window

mercurial