I can't get glutBitmapCharacter() to work

Sage
Posts: 1,234
Joined: 2002.10
Post: #16
The glAArg Demo source contains working glutBitmapCharacter code in an ortho view. It is used to draw the renderer name at the bottom of the window.
Quote this message in a reply
Member
Posts: 70
Joined: 2004.06
Post: #17
Yeah, I am.
Quote this message in a reply
Member
Posts: 70
Joined: 2004.06
Post: #18
I've managed to get text rendering now, using the following code:
Code:
void drawText(int x, int y, char *string)
{
    int i, len;
  
    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    glLoadIdentity();
    glTranslatef(0.0f, 0.0f, -5.0f);
    glRasterPos2i(x, y);
    
    glDisable(GL_TEXTURE);
    glDisable(GL_TEXTURE_2D);
    for (i = 0, len = strlen(string); i < len; i++)
    {    
        glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int)string[i]);
    }
    glEnable(GL_TEXTURE);
    glEnable(GL_TEXTURE_2D);
}

Oddly enough, my application crashes the second time I call glRasterPos2i() in a frame. This means I can only print one line of text. Something, I expect, that will need to researched.

Thanks for all the tips and help you guys have given me though. I appreciate it.
Quote this message in a reply
Post Reply