iosopengl-es-2.0powervr-sgx

pvrtextool cl not generating standard header


I'm using the lastest pvrtextoolCL that I downloaded today.

The issue is that it's not producing the same header as apple's texturetool or the one in it's online documentation. If I use the legacy save out in the gui tool, it works, but I need the options of the command line tool.

Is anyone else having this issue and what can I do to fix it?


Solution

  • If the Legacy Save As option works for you, your code is parsing a Version 2 PVR Texture header. The latest PVRTexTool and PVRTexToolCL both use the Version 3 header format V3.

    If you need command line, you can either

    A) use -pvrlegacy as a command line argument

    B) Use the texturetool provided by Apple with XCode to compress your textures

    C) Update your code to parse a Version 3 PVR Texture header

    Version 2 PVR Texture Header

    typedef struct _PVRTexHeader
    {
        uint32_t headerLength;
        uint32_t height;
        uint32_t width;
        uint32_t numMipmaps;
        uint32_t flags;
        uint32_t dataLength;
        uint32_t bpp;
        uint32_t bitmaskRed;
        uint32_t bitmaskGreen;
        uint32_t bitmaskBlue;
        uint32_t bitmaskAlpha;
        uint32_t pvrTag;
        uint32_t numSurfs;
    } PVRTexHeader;
    

    Version 3 PVR Texture Header

    typedef struct _PVRTexHeaderV3{
        uint32_t    version;            
        uint32_t    flags;          
        uint64_t    pixelFormat;        
        uint32_t    colourSpace;        
        uint32_t    channelType;        
        uint32_t    height;         
        uint32_t    width;          
        uint32_t    depth;          
        uint32_t    numSurfaces;        
        uint32_t    numFaces;       
        uint32_t    numMipmaps;     
        uint32_t    metaDataSize;   
    } PVRTexHeaderV3;
    

    If you are looking to parse a Version 3 Texture header, go grab the PowerVR SDK from:

    http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp

    And have a look at the PVRTTexture.h header. It will have all of the enums to define the flags, and additional structs for the metadata. There is also sample code in the SDK to read the file and load it into OpenGL.