Fonts and GLUT

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).



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.