2010-01-05

轉換 .pvr 檔案格式

最近用 Cocos2d 載入一個背景圖頻頻出錯,原來是 Sprite 圖檔的長寬不可以超過 1024x1024!

如:Sprite *background = [Sprite spriteWithFile:@"BG02.png"];
要是 BG02.png 超過 1024x1024 就會出問題。
我試著把原稿縮小,再於程式裡放大,background.scale = 1.5f;

可是這樣比例又會跑掉了...


可以用 pvr 去處理圖片,但是找遍 Google 卻發現資源不多。
原來 pvr 的工具軟體就在 Xcode 裡。
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool

找到這份技術文件:
Creating textures in the PVRTC compression format

以及 OpenGL ES Programming Guide for iPhone OS 裡的 Using texturetool to Compress Textures

看來又要仔細研究一下了。

.

2 則留言:

  1. Instead of a very large one, you can try load several png files and set their relative position to achieve the same purpose.

    回覆刪除
  2. Thanks Lok,
    It's a good method and I've tried it, too.
    But I want a single image file to be the background.
    I'll try which one's better performance and post it here, follow it.

    回覆刪除