//============================== // BitmapFontLocal::LoadImageFromBuffer bool BitmapFontLocal::LoadImageFromBuffer( char const * imageName, unsigned char const * buffer, size_t bufferSize, bool const isASTC ) { if ( Texture != 0 ) { glDeleteTextures( 1, &Texture ); Texture = 0; } if ( isASTC ) { Texture = LoadASTCTextureFromMemory( buffer, bufferSize, 1 ); } else { Texture = LoadTextureFromBuffer( imageName, MemBuffer( (void *)buffer, bufferSize), TextureFlags_t( TEXTUREFLAG_NO_DEFAULT ), ImageWidth, ImageHeight ); } if ( Texture == 0 ) { LOG( "BitmapFontLocal::Load: failed to load '%s'", imageName ); return false; } LOG( "BitmapFontLocal::LoadImageFromBuffer: success" ); return true; }
void UITexture::LoadTextureFromApplicationPackage( const char *assetPath ) { #if defined( OVR_OS_ANDROID ) Free(); Texture = OVR::LoadTextureFromApplicationPackage( assetPath, TextureFlags_t( TEXTUREFLAG_NO_DEFAULT ), Width, Height ); FreeTextureOfDestruct = true; #else MemBufferFile mbf(MemBufferFile::NoInit); if (mbf.LoadFile(assetPath)) { LoadTextureFromBuffer(assetPath, mbf); mbf.FreeData(); } #endif }
unsigned int LoadTextureFromApplicationPackage( const char * nameInZip, const TextureFlags_t & flags, int & width, int & height ) { void * buffer; int bufferLength; ovr_ReadFileFromApplicationPackage( nameInZip, bufferLength, buffer ); if ( !buffer ) { return 0; } unsigned texId = LoadTextureFromBuffer( nameInZip, MemBuffer( buffer, bufferLength ), flags, width, height ); free( buffer ); return texId; }