Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Fonts and GLUT  (Read 707 times)
0 Members and 1 Guest are viewing this topic.
Offline SamiLakka

JGO n00b
*

Posts: 15


Java games rock!


« on: 2003-11-05 09:37:49 »

Hello again,

what would be the easiest way to print 2D-text to screen? I have tried code from NeHe's tutorial but it doesn't print anything to screen (possibly because I fail to init the font, but I don't know how to do it).

1  
2  
3  
4  
5  
6  
private void printText(String text) {
            byte[] textBytes = text.getBytes();
            gl.glPushAttrib(GL.GL_LIST_BIT);                              // Pushes The Display List Bits
           gl.glListBase(base - 32);                                          // Sets The Base Character to 32            
           gl.glCallLists(text.length(), GL.GL_UNSIGNED_BYTE, textBytes);      // Draws The Display List Text
           gl.glPopAttrib();                                                                  // Pops The Display List Bits

I have created the base by using "base=gl.glGenList(256). Should I init somehow the font?

Thank you.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.095 seconds with 21 queries.