Sign in to follow this  

SDL_TTF font open gl blending issue...

Recommended Posts

I've been working on a program similar to the example presented on the nehe site: Basically, in his program, nehe loads an image file that's basically a sheet containing each ascii character, generates a series of quads that each map to texture coordinates within the sheet, and sets up display lists to generate each of the quads for each of the font characters. This allows him to sequentially call the display lists to render a string of text. I was writing a program that instead uses the SDL_TTF library to render each of the characters to a sheet, pass the sheet's SDL_Surface struct to open gl for use as a texture, then generate the necessary quads and display lists to render the text. I've got it rendering text fine. However, the problems arise when I try to use Ortho2D with blending, to have 2D text overlay the scene. I cannot get solid text to appear that properly overlays the scene. These are some screenshots of the problem. Note that I've since added the glDepthMask(GL_TRUE) statement that I had forgotten: Image 1: TTF_RenderText_Blended in front of black polygon. Note: When I added the glDepthMask(GL_TRUE), I simply had invisible text with no gray box here: Image 2: TTF_RenderText_Blended in front of both in-scene-text and gray background Image 3: TTF_RenderText_Shaded in front of gray background Image 4: TTF_RenderText_Shaded in front of black polygon Image 5: TTF_RenderText_Shaded in front of _in-scene-text Image 6: Full view of the in-scene-text Here's the relevant code: Code to set up open gl textures and display lists; code to generate in-scene text; code to generate ortho2d overlaying text:::: Code to generate SDL Font Sheet - renders each ascii character with TTF, blits them to main sheet surface Code to generate empty sdl rgb surface Man this problem has been driving me NUTS...

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