LWJGL Text Rendering

Posted by Trixmix on Game Development See other posts from Game Development or by Trixmix
Published on 2012-11-01T20:07:48Z Indexed on 2012/11/01 23:23 UTC
Read the original article Hit count: 374

Filed under:
|
|
|

Currently in my project I am using LWJGL and the Slick2D library to render text onto the screen. Here is a more specific example:

    Font f = new Font("Times New Roman",Font.BOLD,18);
    font = new UnicodeFont(f);
    font.getEffects().add(new ColorEffect(Color.white));
    font.addAsciiGlyphs();
    try {
        font.loadGlyphs();
    } catch (SlickException e) {
        e.printStackTrace();
    }

then i use font.drawString to write onto the screen. This is a quick easy way but it has a lot of disadvantages. for example font.loadGlyphs take a very long time 1-3 seconds. so when i want to change a color or font type then i have to wait 1-3 seconds which means I cannot do it while rendering (ie. cant have different color text on the same screen).

My question is what is a better way of drawing multicolored text onto the screen? I use slick2d only for the text rendering so maybe i can fully get rid of the library and draw text some other way...

If you have an answer please leave a quick short example.

Thanks!

© Game Development or respective owner

Related posts about rendering

Related posts about lwjgl