Sign in to follow this  
CurlyDanger

OpenGL 2D Text in OpenGL

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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 stuff
glPopAttrib();



Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this