3

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?

Nico
  • 3,826
  • 1
  • 21
  • 31

2 Answers2

9

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.

Snickers
  • 1,603
  • 11
  • 6
  • 1
    SDK is badly broken on Mac (numerous install failures because of badly packaged installer / app). Up-voting for the copy/paste v3 header - but it would be great if someone would post the PVR source in a way people could actually use it, instead of an "installer installer (that installs an installer)" ... which doesn't work (thanks, Imagination :( ) – Adam Jun 25 '13 at 00:54
0

To complement @Snickers handy post, here's a gist spotted on GitHub for adding PVRv3 parsing. It's for Cocos2D but looks like it's mostly taken from the PVR SDK?

https://gist.github.com/robertjpayne/2928080

Adam
  • 32,900
  • 16
  • 126
  • 153