glRaster

Im having some serious problems when trying to display bitmaps for text using glRasterPos. What happens is the left half of the screen is covered with grainy black blocks and thick lines that flicker on and off, and the frame rate goes from 400+ to 5+ frames per second. here is the code im using:

    GLubyte lettera[13] = {0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18};


glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho (0.0, xres, yres, 0.0, -1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

  glColor3f(1.0, 1.0, 1.0);
  glRasterPos2i(20, 20);
  glBitmap(8, 13, 0.0, 2.0, 10.0, 0.0, lettera);

  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

Any help would be apreciated, thanks.

Drawing bitmaps is slow, which explains your framerate plummet. Is this in a loop? That would explain both the hideous performance hit and the entire half of the screen being covered, but since you’re telling it directly where to put it, maybe not…

Also, you’ll probably want to put this call earlier in the code:

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

Since your letters are eight bits wide, so OpenGL doesn’t try and grab a dword at a time. This will avoid a problem that will cause your bitmap will appear completely f’ed up.

[This message has been edited by Omaha (edited 01-07-2002).]

OK. I added the glPixelStorei(GL_UNPACK_ALIGNMENT, 1);, though i didn’t see any change. One interesting thing i found is that changing the window from fullscreen to windowed, solves all of the problems (the framerate is slower, but much more reasonable). The code isn’t in a loop, well maby it is, heres about how it goes.

while (!GLdone) {
Handle events;
Draw room, aprox 20 triangles
The code i posted earlier
then
SDL_GL_SwapBuffers();

Thanks for the reply.

Are you sure your pixel format is set properly when you’re in windowed mode?