/*!*************************************************************************** @Function APIUpLoadIcons @Description Initialisation and texture upload. Should be called only once for a given context. *****************************************************************************/ bool CPVRTPrint3D::APIUpLoadIcons(const PVRTuint8 * const pIMG, const PVRTuint8 * const pPowerVR) { SPVRTPrint3DAPI::SInstanceData& Data = (m_pAPI->m_pInstanceData ? *m_pAPI->m_pInstanceData : SPVRTPrint3DAPI::s_InstanceData); // Load Icon texture if(Data.uTextureIMGLogo == UNDEFINED_HANDLE) // Static, so might already be initialized. if(PVRTTextureLoadFromPointer((unsigned char*)pIMG, &Data.uTextureIMGLogo) != PVR_SUCCESS) return false; if(Data.uTexturePowerVRLogo == UNDEFINED_HANDLE) // Static, so might already be initialized. if(PVRTTextureLoadFromPointer((unsigned char*)pPowerVR, &Data.uTexturePowerVRLogo) != PVR_SUCCESS) return false; glBindTexture(GL_TEXTURE_2D, 0); return true; }
/*!*************************************************************************** @Function APIUpLoadTexture @Input pSource @Output header @Return bool true if successful. @Description Loads and uploads the font texture from a PVR file. *****************************************************************************/ bool CPVRTPrint3D::APIUpLoadTexture(const PVRTuint8* pSource, const PVRTextureHeaderV3* header, CPVRTMap<PVRTuint32, CPVRTMap<PVRTuint32, MetaDataBlock> >& MetaDataMap) { if(PVRTTextureLoadFromPointer(pSource, &m_pAPI->m_uTextureFont, header, true, 0U, NULL, &MetaDataMap) != PVR_SUCCESS) return false; glBindTexture(GL_TEXTURE_2D, 0); return true; }
/*!*************************************************************************** @Function PVRTTextureLoadFromPVR @Input filename Filename of the .PVR file to load the texture from @Modified texName the OpenGL ES texture name as returned by glBindTexture @Modified psTextureHeader Pointer to a PVR_Texture_Header struct. Modified to contain the header data of the returned texture Ignored if NULL. @Input bAllowDecompress Allow decompression if PVRTC is not supported in hardware. @Input nLoadFromLevel Which mipmap level to start loading from (0=all) @Return PVR_SUCCESS on success @Description Allows textures to be stored in binary PVR files and loaded in. Can load parts of a mipmaped texture (ie skipping the highest detailed levels). Sets the texture MIN/MAG filter to GL_LINEAR_MIPMAP_NEAREST/GL_LINEAR if mipmaps are present, GL_LINEAR/GL_LINEAR otherwise. *****************************************************************************/ EPVRTError PVRTTextureLoadFromPVR( const char * const filename, GLuint * const texName, const void *psTextureHeader, bool bAllowDecompress, const unsigned int nLoadFromLevel) { CPVRTResourceFile TexFile(filename); if (!TexFile.IsOpen()) return PVR_FAIL; return PVRTTextureLoadFromPointer( TexFile.DataPtr(), texName, psTextureHeader, bAllowDecompress, nLoadFromLevel); }