Hi,
What's the best way to implement font rendering on PSP? I've seen programs write directly to uncached VRAM, as well as using swizzled textures. I personally prefer to use sceGuDrawArray(GU_POINTS), but I haven't seen anyone else do it this way.
If you've tested various different methods, it'd be great to get a pros/cons type of comparison. For example, I'm sure writing to VRAM directly is fast, but will it bring up uncached memory access issues, when mixed with other code?
Also, if textures are used, is it still possible to control the color of the font?
Thanks
P.S. I'm not really interested in existing libraries for font rendering, as I know there are several
Low-level font rendering
in my personal experience the best way to do so is to load an "alphabet texture" and then render chars as textured sprites. You could even create a list for each char. So it will be faster if you swizzle your texture once loaded and for all. Oh and if you do so you can invalidate cache only at the end of the entire rendering process. A different story has to be told if you would like to render trueType...
PS: my chars are grayscale+alpha. ....try playing with sceGuColor and similar functions
PS: my chars are grayscale+alpha. ....try playing with sceGuColor and similar functions
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
There are several options available, you'll have to decide on the best method to suit your own needs.
In my pgeFont implementation I load a TTF font and generate a 4-bit swizzled texture from that, which can be stored in either VRAM or RAM.
As jean mentioned, these are displayed by using a list for the characters and their position on the texture - after that they're just drawn using modulate, sceGuColor() to set the color and render as GU_SPRITES.
The benefits of this are that the memory footprint is small, only ~32kb for a 256x256 texture and that it is very very fast.
The downside is that the size of the font is set at load/creation. However because the memory footprint is so small you can always load the font multiple times at multiple sizes.
Hope this helps.
In my pgeFont implementation I load a TTF font and generate a 4-bit swizzled texture from that, which can be stored in either VRAM or RAM.
As jean mentioned, these are displayed by using a list for the characters and their position on the texture - after that they're just drawn using modulate, sceGuColor() to set the color and render as GU_SPRITES.
The benefits of this are that the memory footprint is small, only ~32kb for a 256x256 texture and that it is very very fast.
The downside is that the size of the font is set at load/creation. However because the memory footprint is so small you can always load the font multiple times at multiple sizes.
Hope this helps.