forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Low-level font rendering

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
uberjack



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Thu Jul 31, 2008 6:32 pm    Post subject: Low-level font rendering Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Thu Jul 31, 2008 7:30 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Jul 31, 2008 7:56 pm    Post subject: Reply with quote

Right now, I like using the built-in fonts via intraFont. That works rather well.
Back to top
View user's profile Send private message AIM Address
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Thu Jul 31, 2008 10:40 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
uberjack



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Fri Aug 01, 2008 7:26 am    Post subject: Reply with quote

Thanks for the responses, everyone.
Sounds like swizzled textures present the best approach.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group