From 52d0f712a5e7484eefd8f33fa6290d9cfedba888 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Fri, 20 Sep 2019 11:15:51 +0100 Subject: [PATCH] Fix framebuffer rendering for native image source on Ubuntu Change-Id: I1438b8af9b38efe6dc3c0e94979633b364ea3ba8 --- .../render/renderers/render-texture-frame-buffer.cpp | 10 +--------- dali/internal/render/renderers/render-texture.cpp | 2 +- dali/internal/render/renderers/render-texture.h | 13 +++++++++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dali/internal/render/renderers/render-texture-frame-buffer.cpp b/dali/internal/render/renderers/render-texture-frame-buffer.cpp index 4e5cd51..fb718fb 100644 --- a/dali/internal/render/renderers/render-texture-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-texture-frame-buffer.cpp @@ -89,15 +89,7 @@ void TextureFrameBuffer::AttachColorTexture( Context& context, Render::Texture* // Create a color attachment. if( texture->GetType() == TextureType::TEXTURE_2D ) { - if( !texture->IsNativeImage() ) - { - context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureId, mipmapLevel ); - } - else - { - // If it's a native image we need to use GL_TEXTURE_EXTERNAL_OES as the texture target parameter - context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, mTextureId, mipmapLevel ); - } + context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture->GetTarget(), mTextureId, mipmapLevel ); } else { diff --git a/dali/internal/render/renderers/render-texture.cpp b/dali/internal/render/renderers/render-texture.cpp index a2f11bc..2937453 100644 --- a/dali/internal/render/renderers/render-texture.cpp +++ b/dali/internal/render/renderers/render-texture.cpp @@ -912,7 +912,7 @@ void Texture::ApplySampler( Context& context, Render::Sampler* sampler ) } } -bool Texture::HasAlphaChannel() +bool Texture::HasAlphaChannel() const { return mHasAlpha; } diff --git a/dali/internal/render/renderers/render-texture.h b/dali/internal/render/renderers/render-texture.h index 86f32f1..e23d28a 100755 --- a/dali/internal/render/renderers/render-texture.h +++ b/dali/internal/render/renderers/render-texture.h @@ -108,18 +108,27 @@ public: * Retrieve wheter the texture has an alpha channel * @return True if the texture has alpha channel, false otherwise */ - bool HasAlphaChannel(); + bool HasAlphaChannel() const; /** * Get the id of the texture * @return Id of the texture */ - GLuint GetId() + GLuint GetId() const { return mId; } /** + * Get the target to which the texture is bound + * @return target to which the texture is bound + */ + GLuint GetTarget() const + { + return mTarget; + } + + /** * Get the type of the texture * @return Type of the texture */ -- 2.7.4