glutBitmapCharacter issue

I everyone, I am having an issue with OpenGL en Glut. I have made a OpenGL code in order to render terrain with perlin noise, billboards etc. And i’m wanting to add some font display, the problem is that when i want to use the glutBitmapCharacter I have an OpenGL error and the font does not appear.

glColor3f(r, g, b);
glRasterPos2f(x, y);
int len, i;
len = (int)strlen(string);
for (i = 0; i < len; i++) {
    glutBitmapCharacter(font , string[i]);

Thank you in advance for the help ! :slight_smile:

Core profile or compatibility profile? The functions you’re using won’t work in the core profile (which doesn’t support bitmaps, or the notion of raster position).

Have you set the fixed-function model-view and projection matrices? The argument to glRasterPos is transformed by these, but if you’ve been using a vertex shader you may have had no reason to set them (unless it uses gl_ModelViewMatrix or similar). You can use glWindowPos to specify the raster position in window coordinates.

1 Like

I’m using uniform variable for the model view and projection matrix. For the profile I think i’m using the compatibility one since i’m using :


Edit : I was not aware but i was also setting the core profile as well… With the compatibility one I have no GL error Thanks ! Even if i still not able to see te font ^^

Working now ! I Had to add before the rendering of the font


And after the rendering of the font


It’s working fine now thank you for your help GClements !