// INTERNAL INCLUDES
#include <dali/public-api/images/native-image-interface.h>
#include <dali/devel-api/images/native-image-interface-extension.h>
+#include <dali/integration-api/gl-defines.h>
namespace Dali
{
inline const char* GetCustomFragmentPreFix(){return "#extension GL_OES_EGL_image_external:require\n";}
inline const char* GetCustomSamplerTypename(){return "samplerExternalOES";}
+ inline int GetEglImageTextureTarget(){return GL_TEXTURE_EXTERNAL_OES;}
+
};
class DALI_IMPORT_API TestNativeImage : public Dali::NativeImageInterface
virtual const char* GetCustomSamplerTypename() = 0;
/**
+ * @brief Get texture target for binding native image as texture.
+ *
+ * @return Texture target.
+ */
+ virtual int GetEglImageTextureTarget() = 0;
+
+ /**
* @brief Retrieve the extension for the interface.
*
* @return Extension2 pointer if available, NULL otherwise
}
/**
+ * Wrapper for OpenGL ES 2.0 glBindTexture( target )
+ */
+ void BindTexture( int target, GLuint texture )
+ {
+ if (mBound2dTextureId[ mActiveTextureUnit ] != texture)
+ {
+ mBound2dTextureId[ mActiveTextureUnit ] = texture;
+
+ LOG_GL("BindTexture target(%d) %d\n", target, texture);
+ CHECK_GL( mGlAbstraction, mGlAbstraction.BindTexture(target, texture) );
+ }
+ }
+
+ /**
* Wrapper for OpenGL ES 2.0 glBindTexture(GL_TEXTURE_CUBE_MAP)
*/
void BindCubeMapTexture( GLuint texture )
#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/render/gl-resources/texture-units.h>
#include <dali/internal/render/gl-resources/gl-texture.h>
+#include <dali/devel-api/images/native-image-interface-extension.h>
namespace Dali
{
{
// Bind the texture id
mContext.ActiveTexture( textureunit );
- mContext.Bind2dTexture(mId);
+ int textureTarget = GL_TEXTURE_2D;
+ NativeImageInterface::Extension* extension = mNativeImage->GetExtension();
+ if( extension )
+ {
+ textureTarget = extension->GetEglImageTextureTarget();
+ }
+
+ mContext.BindTexture( textureTarget, mId );
mNativeImage->PrepareTexture();
}
{
mContext.GenTextures( 1, &mId );
mContext.ActiveTexture( TEXTURE_UNIT_UPLOAD ); // bind in unused unit so rebind works the first time
- mContext.Bind2dTexture( mId );
+
+ int textureTarget = GL_TEXTURE_2D;
+ NativeImageInterface::Extension* extension = mNativeImage->GetExtension();
+ if( extension )
+ {
+ textureTarget = extension->GetEglImageTextureTarget();
+ }
+
+ mContext.BindTexture( textureTarget, mId );
mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); // We always use tightly packed data