PowerVR Software Development Kit |
00001 /*!*************************************************************************** 00002 @File OGLES/PVRTTexture.h 00003 00004 @Brief GL texture loading. 00005 00006 @Author PowerVR 00007 00008 @Date June 2004 00009 00010 @Copyright Copyright 2003-2004 by Imagination Technologies Limited. 00011 All rights reserved. No part of this software, either 00012 material or conceptual may be copied or distributed, 00013 transmitted, transcribed, stored in a retrieval system 00014 or translated into any human or computer language in any 00015 form by any means, electronic, mechanical, manual or 00016 other-wise, or disclosed to third parties without the 00017 express written permission of Imagination Technologies 00018 Limited, Unit 8, HomePark Industrial Estate, 00019 King's Langley, Hertfordshire, WD4 8LZ, U.K. 00020 00021 @Platform ANSI compatible 00022 00023 @Description GL texture loading. 00024 00025 $Revision: 1.7 $ 00026 *****************************************************************************/ 00027 #ifndef _PVRTTEXTURE_H_ 00028 #define _PVRTTEXTURE_H_ 00029 00030 00031 /*!*************************************************************************** 00032 Describes the header of a PVR header-texture 00033 *****************************************************************************/ 00034 typedef struct PVR_Header_Texture_TAG 00035 { 00036 unsigned long dwHeaderSize; 00037 unsigned long dwHeight; 00038 unsigned long dwWidth; 00039 unsigned long dwMipMapCount; 00040 unsigned long dwpfFlags; 00041 unsigned long dwTextureDataSize; 00042 unsigned long dwBitCount; 00043 unsigned long dwRBitMask; 00044 unsigned long dwGBitMask; 00045 unsigned long dwBBitMask; 00046 unsigned long dwAlphaBitMask; 00047 } PVR_Texture_Header; 00048 00049 enum{ 00050 ShellTextureLoadErr_UnsupportedTexture = 1, 00051 ShellTextureLoadErr_TwiddledTexture 00052 }; 00053 00054 00055 /***************************************************************************** 00056 ** Functions 00057 *****************************************************************************/ 00058 00059 /*!*************************************************************************** 00060 @Function PVRTTextureCreate 00061 @Input w Size of the texture 00062 @Input h Size of the texture 00063 @Input wMin Minimum size of a texture level 00064 @Input hMin Minimum size of a texture level 00065 @Input nBPP Bits per pixel of the format 00066 @Input bMIPMap Create memory for MIP-map levels also? 00067 @Return Allocated texture memory (must be free()d) 00068 @Description Creates a PVR_Texture_Header structure, including room for 00069 the specified texture, in memory. 00070 *****************************************************************************/ 00071 PVR_Texture_Header *PVRTTextureCreate( 00072 unsigned int w, 00073 unsigned int h, 00074 const unsigned int wMin, 00075 const unsigned int hMin, 00076 const unsigned int nBPP, 00077 const bool bMIPMap); 00078 00079 /*!*************************************************************************** 00080 @Function PVRTTextureTile 00081 @Modified pOut The tiled texture in system memory 00082 @Input pIn The source texture 00083 @Input nRepeatCnt Number of times to repeat the source texture 00084 @Description Allocates and fills, in system memory, a texture large enough 00085 to repeat the source texture specified number of times. 00086 *****************************************************************************/ 00087 void PVRTTextureTile( 00088 PVR_Texture_Header **pOut, 00089 const PVR_Texture_Header * const pIn, 00090 const int nRepeatCnt); 00091 00092 /*!*************************************************************************** 00093 @Function PVRTLoadDecompressedTextureFromPointer 00094 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00095 @Input pointer Pointer to the header-prefixed texture from 00096 @Return true on success 00097 @Description Allows textures to be stored in header files and loaded in. Loads the whole texture 00098 Release texture by calling PVRTReleaseTexture. Decompresses to RGBA8888 internally. 00099 *****************************************************************************/ 00100 bool PVRTLoadDecompressedTextureFromPointer(void* pointer, GLuint *texName); 00101 00102 /*!*************************************************************************** 00103 @Function PVRTLoadDecompressedPartialTextureFromPointer 00104 @Input pointer Pointer to the header-prefixed texture from 00105 @Input nLoadFromLevel Which mipmap level to start loading from (0=all) 00106 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00107 @Return true on success 00108 @Description Allows textures to be stored in header files and loaded in. Loads the whole texture 00109 Release texture by calling PVRTReleaseTexture. Decompresses to RGBA8888 internally. 00110 *****************************************************************************/ 00111 bool PVRTLoadDecompressedPartialTextureFromPointer(void *pointer, unsigned int nLoadFromLevel, GLuint *texName); 00112 00113 /*!*************************************************************************** 00114 @Function PVRTLoadPartialTextureFromPointer 00115 @Input pointer Pointer to header-texture's structure 00116 @Input texPtr If null, texture follows header, else texture is here. 00117 @Input nLoadFromLevel Which mipmap level to start loading from (0=all) 00118 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00119 @Return true on success 00120 @Description Allows textures to be stored in C header files and loaded in. Can load parts of a 00121 mipmaped texture (ie skipping the highest detailed levels). Release texture by calling 00122 PVRTReleaseTexture. 00123 *****************************************************************************/ 00124 bool PVRTLoadPartialTextureFromPointer(void* pointer, void *texPtr, unsigned int nLoadFromLevel, GLuint *texName); 00125 00126 /*!*************************************************************************** 00127 @Function OGLESShellLoadTextureFromPointer 00128 @Input pointer Pointer to header-texture's structure 00129 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00130 @Return true on success 00131 @Description Allows textures to be stored in C header files and loaded in. Loads the whole texture. 00132 Release texture by calling PVRTReleaseTexture. 00133 *****************************************************************************/ 00134 bool PVRTLoadTextureFromPointer(void* pointer, GLuint *texName); 00135 00136 00137 /*!*************************************************************************** 00138 @Function PVRTLoadPartialTextureFromPVR 00139 @Input filename Filename of the .PVR file to load the texture from 00140 @Input altHeader If null, texture follows header, else texture is here. 00141 @Input nLoadFromLevel Which mipmap level to start loading from (0=all) 00142 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00143 @Return true on success 00144 @Description Allows textures to be stored in binary PVR files and loaded in. Can load parts of a 00145 mipmaped texture (ie skipping the highest detailed levels). Release texture by 00146 calling PVRTReleaseTexture. 00147 *****************************************************************************/ 00148 bool PVRTLoadPartialTextureFromPVR(char* filename, char *altHeader, unsigned int nLoadFromLevel, GLuint *texName); 00149 00150 /*!*************************************************************************** 00151 @Function PVRTLoadTextureFromPVR 00152 @Input filename Filename of the .PVR file to load the texture from 00153 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00154 @Return true on success 00155 @Description Allows textures to be stored in binary PVR files and loaded in. Loads the whole texture 00156 Release texture by calling PVRTReleaseTexture. 00157 *****************************************************************************/ 00158 bool PVRTLoadTextureFromPVR(char* filename, GLuint *texName); 00159 00160 /*!*************************************************************************** 00161 @Function PVRTLoadDecompressedPartialTextureFromPVR 00162 @Input filename Filename of the .PVR file to load the texture from 00163 @Input nLoadFromLevel Which mipmap level to start loading from (0=all) 00164 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00165 @Return true on success 00166 @Description Allows textures to be stored in binary PVR files and loaded in. Can load parts of a 00167 mipmaped texture (ie skipping the highest detailed levels). Release texture by 00168 calling PVRTReleaseTexture. This variant decompresses to RGBA8888. 00169 *****************************************************************************/ 00170 bool PVRTLoadDecompressedPartialTextureFromPVR(char* filename, unsigned int nLoadFromLevel, GLuint *texName); 00171 00172 /*!*************************************************************************** 00173 @Function PVRTLoadDecompressedTextureFromPVR 00174 @Input filename Filename of the .PVR file to load the texture from 00175 @Modified texName the OpenGL ES texture name as returned by glBindTexture 00176 @Return true on success 00177 @Description Allows textures to be stored in binary PVR files and loaded in. Loads the whole texture 00178 Release texture by calling PVRTReleaseTexture. This variant decompresses to RGBA8888. 00179 *****************************************************************************/ 00180 bool PVRTLoadDecompressedTextureFromPVR(char* filename, GLuint *texName); 00181 00182 /*!*************************************************************************** 00183 @Function PVRTReleaseTexture 00184 @Input texName the name returned by PVRTLoadTextureFromPointer or 00185 PVRTLoadTextureFromPVR 00186 @Description Releases the resources used by a texture. 00187 *****************************************************************************/ 00188 void PVRTReleaseTexture(GLuint texName); 00189 00190 /*!*************************************************************************** 00191 @Function PVRTTextureFormatBPP 00192 @Input nFormat 00193 @Input nType 00194 @Description Returns the bits per pixel (BPP) of the format. 00195 *****************************************************************************/ 00196 unsigned int PVRTTextureFormatBPP(const GLuint nFormat, const GLuint nType); 00197 00198 00199 #endif /* _PVRTTEXTURE_H_ */ 00200 00201 /***************************************************************************** 00202 End of file (PVRTTexture.h) 00203 *****************************************************************************/
Copyright © 1999-2006, PowerVR Technologies and partners. PowerVR Technologies is a division of Imagination Technologies Ltd.