Fixed glBindFramebuffer(0) issue for Direct Rendering

optimization.  current_fbo wasn't being set to 0 
so the above case wasn't being handled properly. 



SVN revision: 68392
This commit is contained in:
Sung Park 2012-02-24 08:13:48 +00:00
parent cf926fda0b
commit ac0d52f04d
1 changed files with 10 additions and 7 deletions

View File

@ -3514,24 +3514,27 @@ evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
{ {
Render_Engine_GL_Context *ctx = current_evgl_ctx; Render_Engine_GL_Context *ctx = current_evgl_ctx;
if (!ctx)
{
ERR("No current context set.");
return;
}
// Take care of BindFramebuffer 0 issue // Take care of BindFramebuffer 0 issue
if (framebuffer==0) if (framebuffer==0)
{ {
if (gl_direct_enabled) if (gl_direct_enabled)
glBindFramebuffer(target, 0); glBindFramebuffer(target, 0);
else if (ctx) else
{ glBindFramebuffer(target, ctx->context_fbo);
glBindFramebuffer(target, ctx->context_fbo); ctx->current_fbo = 0;
ctx->current_fbo = 0;
}
} }
else else
{ {
glBindFramebuffer(target, framebuffer); glBindFramebuffer(target, framebuffer);
// Save this for restore when doing make current // Save this for restore when doing make current
if (ctx) ctx->current_fbo = framebuffer;
ctx->current_fbo = framebuffer;
} }
} }