2D Text in OpenGL

Started by
4 comments, last by T1Oracle 18 years, 5 months ago
Hello everyone, I'm trying to get 2D Text into a 3D game using OpenGL with SDL. The team has decided to make the game platform independant to the best of our ability so I can't use any window functions. I found NeHe's tutorial (#17) helpful getting me started, but the text is transparent and changes color depending on the color bellow it. This is doesn't work for our game since it will mostly use vertex colors and shading and the text will need to be completely opaque on top of everything. Does anyone have any useful hints for getting a completely opaque fonts in OpenGL or have any links to any better tutorials? Thanks.
Advertisement
http://www.opengl.org/resources/code/rendering/mjktips/TexFont/TexFont.html
It seems like a nice api, but it causes a rediculous amount of errors in gl.h. Is this code compatible with all versions of openGL?
Just a thought. With NeHe's, couldn't you just push and pop the color attribute list before and after the text. And disable blending if you don't want your text to be transparent. For example.

glPushAttrib(GL_COLOR_BUFFER_BIT);//Draw your text and stuffglPopAttrib();


Quote:Original post by CurlyDanger
It seems like a nice api, but it causes a rediculous amount of errors in gl.h. Is this code compatible with all versions of openGL?


I think it's for X windows. I never used the given code but I found the tutorial most useful in writing my own font renderer.
That's how I used that site too, I wrote my own Font system using that. I also added support for getting the screen coordinates of printed blocks of text in my system. There are font api's out there though check this thread link
Programming since 1995.

This topic is closed to new replies.

Advertisement