Implementing a console

Hello,

I’d like to implement a console displaying a lot of text.
glut.glutBitmapString is very slow.
Mapping a piece of texture over a quad (one quad per char) is also quite slow, even using opengl lists with a lot of text.

As my kind of text does not change often, I had the idea of drawing it only when it changes.
I am trying to use a pbuffer and render the console into it, then use it as a texture, and display it over a quad.

Is it the best solution ? Are there other solutions to do something like that ? I feel like I am using something quite complicated for solving this problem.

Thanks

Hi,

The following piece of code is quite fast for drawing characters :

…/…

    for( int i = rec.first; i < rec.first + rec.num_chars; i++ )
    {
        bmpChar = rec.ch[i-rec.first];
        if( bmpChar == null )
        {
            continue;
        }
        gl.glNewList ( i, GL.GL_COMPILE );
        {
            gl.glBitmap ( bmpChar.width, bmpChar.height, 
                        bmpChar.xorig, bmpChar.yorig,
                        bmpChar.advance, 0,bmpChar.bitmap);
        }
        gl.glEndList ();
    }       

…/…

public void drawString( GL gl, String s )
{
    gl.glPushAttrib ( GL.GL_LIST_BIT );
    gl.glCallLists ( s.length (), GL.GL_UNSIGNED_SHORT, s.toCharArray () );
    gl.glPopAttrib ();
}

If your text doesn’t change often you draw it into a pBuffer is a very good solution too.