I'm trying to write a 2D graphical program in c++ using openGL and the GLUT toolkit. The problem is that every time I run my program it opens a window with the correct image then the screen freezes (I can move the mouse but the computer will not respond to anything). Every few seconds the screen flickers black. I have looked around online and other people have had similar problems and it seems to be related to compiz. The standard fix seems to be disabling compiz but I don't want to do that.

Does anyone know a fix or work around?

Other potentially useful info:
-I'm using ubuntu 11.04
-It happens consistently when I use glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12,(int) text[i]); without this it happens infrequently