// 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
{
* 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
*/