Skip to content

Commit

Permalink
Minor refactor: Use create_offscreen_context_common() for CGL
Browse files Browse the repository at this point in the history
  • Loading branch information
kintel committed Mar 13, 2023
1 parent dbb29a2 commit 0f5edbe
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/glview/OffscreenContextCGL.mm
Expand Up @@ -77,26 +77,13 @@

[ctx->openGLContext makeCurrentContext];

// glewInit must come after Context creation and before FBO calls.
GLenum err = glewInit();
if (GLEW_OK != err) {
std::cerr << "Unable to init GLEW: " << glewGetErrorString(err) << std::endl;
auto *returnCtx = create_offscreen_context_common(ctx);
if (!returnCtx) {
[ctx->openGLContext release];
[ctx->pool release];
delete ctx;
return nullptr;
}
glew_dump();

ctx->fbo = fbo_new();
if (!fbo_init(ctx->fbo, w, h)) {
[ctx->openGLContext release];
[ctx->pool release];
delete ctx;
return nullptr;
}

return ctx;
return returnCtx;
}

bool teardown_offscreen_context(OffscreenContext *ctx)
Expand Down

0 comments on commit 0f5edbe

Please sign in to comment.