我使用的是我今天下载的最新 pvrtextoolCL。
问题是它生成的 header 与 apple 的 texturetool 或其在线文档中的 header 不同。如果我在 gui 工具中使用 legacy save out,它可以工作,但我需要命令行工具的选项。
还有其他人遇到这个问题吗?我该如何解决?
最佳答案
如果旧版另存为选项适合您,则您的代码正在解析版本 2 PVR 纹理 header 。最新的 PVRTexTool 和 PVRTexToolCL 均使用版本 3 header 格式 V3。
如果你需要命令行,你可以
A) 使用-pvrlegacy 作为命令行参数
B) 使用 Apple 提供的 texturetool 和 XCode 来压缩你的纹理
C) 更新您的代码以解析版本 3 PVR 纹理 header
版本 2 PVR 纹理标题
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;
版本 3 PVR 纹理标题
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;
如果您希望解析第 3 版纹理 header ,请从以下位置获取 PowerVR SDK:
http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp
并查看 PVRTTexture.h header 。它将具有所有用于定义标志的枚举,以及用于元数据的附加结构。 SDK 中还有读取文件并将其加载到 OpenGL 中的示例代码。
关于ios - pvrtextool cl 不生成标准 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695077/