★ TouchArcade needs your help. Click here to support us on Patreon.

Handy tip for those using PVRTC textures

07-22-2009, 10:27 AM
#1
Joined: Sep 2008
Location: Minnesota
Posts: 63
Handy tip for those using PVRTC textures

Double click your app target to pull up it's settings. Then add a custom rule like so:


Not sure how many people really use PVRTC textures, but this saves quite a bit of time. Instead of generating the textures on the command line every time, just add the source image files (yes it even works with PSDs) to your project and it will generate them at build time if they are needed or need to be regenerated. The rule swaps the generated file for the original automagically so you won't actually be adding your multi-megabyte layered PSD files to your app.

Enjoy!

Scott Lembcke - Howling Moon Software (blog)
Author of CrayonBall and the popular Chipmunk Physics Library
Check out our new game Twilight Golf! Physics puzzles and dynamic shadows!
07-24-2009, 09:11 AM
#2
Joined: Feb 2009
Location: Sweden
Posts: 1,634
We use compressed textures, but I convert them manually

Is it possible to only convert in a certain dir (instead of all files in all dirs)? Also, is it possible to match several file types (i.e. *.png *.jpg)?
07-24-2009, 09:24 AM
#3
Joined: Sep 2008
Location: Minnesota
Posts: 63
Quote:
Originally Posted by Anders View Post
We use compressed textures, but I convert them manually

Is it possible to only convert in a certain dir (instead of all files in all dirs)? Also, is it possible to match several file types (i.e. *.png *.jpg)?
The filter is just a glob, so you can make it match whatever. You can also put more than one pattern in if you separate it by a space. You can't have it just run it on certain directories, but you can get the same effect by tagging the name in some way. For instance say you want it to convert "image-pvr.png" and "image-pvr.jpg" but not "image.png" and "image.jpg". Then you would use "*-pvr.png *-pvr.jpg" as your pattern.

Scott Lembcke - Howling Moon Software (blog)
Author of CrayonBall and the popular Chipmunk Physics Library
Check out our new game Twilight Golf! Physics puzzles and dynamic shadows!
07-24-2009, 09:33 AM
#4
Joined: Feb 2009
Location: Sweden
Posts: 1,634
Quote:
Originally Posted by slembcke View Post
The filter is just a glob, so you can make it match whatever. You can also put more than one pattern in if you separate it by a space. You can't have it just run it on certain directories, but you can get the same effect by tagging the name in some way. For instance say you want it to convert "image-pvr.png" and "image-pvr.jpg" but not "image.png" and "image.jpg". Then you would use "*-pvr.png *-pvr.jpg" as your pattern.
Great, thanks a lot! Will try it on Monday.
08-12-2009, 01:07 PM
#5
Joined: Sep 2008
Location: Minnesota
Posts: 63
Found out from somebody that there is an issue with spaces in the names. You need to put quotes around the filenames in the shell command (but not in the filename box).

Code:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool --bits-per-pixel-4 -e PVRTC -o "$BUILD_DIR/$INPUT_FILE_BASE.pvrtc" "$INPUT_FILE_PATH"
I though sh split tokens then substituted variables, but apparently not. Enjoy.

Scott Lembcke - Howling Moon Software (blog)
Author of CrayonBall and the popular Chipmunk Physics Library
Check out our new game Twilight Golf! Physics puzzles and dynamic shadows!