Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 8:02 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Jul 08, 2012 9:49 pm 
Offline

Joined: Sun Jul 08, 2012 9:35 pm
Posts: 3
After alot of researching for a way to to render text to the window with lwjgl i found this class "AngelCodeFont" plus the little generator from AngelCode.

I am new to lwjgl and openGL, and i realize i can have made som rookie mistake.

I have followed a guide from this forum on how i should exprt the font from the generator. (32bit depth, A: glyph R:one G:one B:one, PNG)

This is a print of my result: http://imageshack.us/photo/my-images/83 ... dtext.png/

Here is my code: https://gist.github.com/3072889

Thanks you for your time!
Sincerely Dennis


Top
 Profile  
 
PostPosted: Sun Jul 08, 2012 10:03 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1467
Could you post the font image and definition?

Try using Hiero or (better yet) TWL's font tool - check "Save Full Image" and select "Text" instead of XML. Your code should work fine, although I've suggest enabling blending in GL setup if you want your text to appear smooth:
Code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


Also I'd suggest the following for your game loop:
Code:
      while(!Display.isCloseRequested()){
         //no need for depth buffer
         glClear(GL_COLOR_BUFFER_BIT);
         
         //matrix mode is already set, no need for this:
         //glMatrixMode(GL_MODELVIEW);
         
         glLoadIdentity();
         
         renderText();

         Display.update();

         //place after update
         Display.sync(60);
      }


Top
 Profile  
 
PostPosted: Sun Jul 08, 2012 10:12 pm 
Offline

Joined: Sun Jul 08, 2012 9:35 pm
Posts: 3
Here is my img: http://imageshack.us/f/812/font0.png/

I hope you can see it. Its white on alpha BG.

I i took a print on the settings: http://imageshack.us/f/233/exportsettings.png/

Here's the fnt file:

EDIT: removed this file, nothing to do with the problem. Only takes space


Last edited by gnorriz on Sun Jul 08, 2012 10:30 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Jul 08, 2012 10:18 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1467
Just tested -- enabling blending will fix your problem.


Top
 Profile  
 
PostPosted: Sun Jul 08, 2012 10:26 pm 
Offline

Joined: Sun Jul 08, 2012 9:35 pm
Posts: 3
It did!

Thx for youre time! You are an angel for spending time to help newbies like me!

Sincerely Dennis

davedes wrote:
Just tested -- enabling blending will fix your problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group