Hello, I wrote a font function and it worked perfectly in my program but for some reason it doesn’t work anymore. I know the font function works right because if I start a new program and use it it works there, but for some reason it doesn’t want to display any text in my current program anymore. Are there any functions that need to be disabled before rendering the font? Such as glDisable(GL_CULL_FACE) or anything of the sort. Thanks for the help.
You have to disable lighting before redering the font with
glDisable(GL_LIGHTING)and then enable it again with glEnable(GL_LIGHTING)or you will have problems.
Things that could go wrong:
Depth testing, projection matrix, modelview matrix, alpha testing, texture matrix, texture image, vertex format, client enables, mis-matched push/pops, …
Try removing pieces of your program until you can get it to work again.
Also, this is not at all an OpenGL question; this is a general “how do I debug stuff” question. Not that I know of a good “how to debug stuff” mailing list to refer you to, though; everyone I know learned this the hard way.
Also, you should sprinkle your program with assert(!glGetError()) – this will pull a full stop when you make some mistake. Then you can go back and debug it. You should put these EVERYWHERE – they’ll be taken out in release mode, so they cost nothing in the final product.