context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
}
-void FrameBuffer::AttachColorTexture( Context& context, Render::NewTexture* texture, unsigned int mipmapLevel, unsigned int layer )
+void FrameBuffer::AttachColorTexture( Context& context, Render::Texture* texture, unsigned int mipmapLevel, unsigned int layer )
{
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
// Create a color attachment.
if( texture->GetType() == TextureType::TEXTURE_2D )
{
- context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->GetId(), mipmapLevel );
+ if( !texture->IsNativeImage() )
+ {
+ context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->GetId(), 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, texture->GetId(), mipmapLevel );
+ }
}
else
{