X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fgraphics%2Fgles-impl%2Fgles-graphics-framebuffer.cpp;h=d9091460285260dcba13d8f37bfe40d3b58fc253;hb=5a309b7db8eade971a38b0728cd4dc5cfdccaa8a;hp=2e529343bed3c5d40b18af3fe93b7b19a2cb7455;hpb=f730545fafee7a4f65d966a9b28bb80fba9ba93a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/graphics/gles-impl/gles-graphics-framebuffer.cpp b/dali/internal/graphics/gles-impl/gles-graphics-framebuffer.cpp index 2e52934..d909146 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-framebuffer.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-framebuffer.cpp @@ -92,13 +92,14 @@ Framebuffer::~Framebuffer() = default; bool Framebuffer::InitializeResource() { - auto gl = mController.GetGL(); - if(gl && !mInitialized) + auto context = mController.GetCurrentContext(); + auto gl = mController.GetGL(); + if(gl && context && !mInitialized) { mInitialized = true; - gl->GenFramebuffers(1, &mFramebufferId); - gl->BindFramebuffer(GL_FRAMEBUFFER, mFramebufferId); + context->GenFramebuffers(1, &mFramebufferId); + context->BindFrameBuffer(GL_FRAMEBUFFER, mFramebufferId); for(Graphics::ColorAttachment& attachment : mCreateInfo.colorAttachments) { @@ -106,7 +107,7 @@ bool Framebuffer::InitializeResource() } // @todo is this per framebuffer, or more immediate state that needs setting when framebuffer changed? - gl->DrawBuffers(mCreateInfo.colorAttachments.size(), COLOR_ATTACHMENTS); + context->DrawBuffers(mCreateInfo.colorAttachments.size(), COLOR_ATTACHMENTS); if(mCreateInfo.depthStencilAttachment.depthTexture) { @@ -135,7 +136,8 @@ bool Framebuffer::InitializeResource() AttachTexture(stencilTexture, attachmentId, 0, mCreateInfo.depthStencilAttachment.stencilLevel); } - gl->BindFramebuffer(GL_FRAMEBUFFER, 0); + + context->BindFrameBuffer(GL_FRAMEBUFFER, 0); } return mInitialized; @@ -143,8 +145,9 @@ bool Framebuffer::InitializeResource() void Framebuffer::DestroyResource() { - auto gl = mController.GetGL(); - if(gl && mInitialized) + auto context = mController.GetCurrentContext(); + auto gl = mController.GetGL(); + if(gl && context && mInitialized) { if(mDepthBufferId) { @@ -155,7 +158,8 @@ void Framebuffer::DestroyResource() gl->DeleteRenderbuffers(1, &mStencilBufferId); } - gl->DeleteFramebuffers(1, &mFramebufferId); + context->DeleteFramebuffers(1, &mFramebufferId); + mFramebufferId = 0u; mInitialized = false; } @@ -168,8 +172,13 @@ void Framebuffer::DiscardResource() void Framebuffer::Bind() const { - auto gl = mController.GetGL(); - gl->BindFramebuffer(GL_FRAMEBUFFER, mFramebufferId); + auto context = mController.GetCurrentContext(); + auto gl = mController.GetGL(); + + if(gl && context) + { + context->BindFrameBuffer(GL_FRAMEBUFFER, mFramebufferId); + } } void Framebuffer::AttachTexture(const Graphics::Texture* texture, uint32_t attachmentId, uint32_t layerId, uint32_t levelId)