Sign in to follow this  
datahead8888

SDL_TTF font open gl blending issue...

Recommended Posts

datahead8888    163
I've been working on a program similar to the example presented on the nehe site: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17 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: http://tinypic.com/r/4rqoh0/5 Image 2: TTF_RenderText_Blended in front of both in-scene-text and gray background http://tinypic.com/r/15oi2c6/5 Image 3: TTF_RenderText_Shaded in front of gray background http://tinypic.com/r/hun69e/5 Image 4: TTF_RenderText_Shaded in front of black polygon http://tinypic.com/r/16atstx/5 Image 5: TTF_RenderText_Shaded in front of _in-scene-text http://tinypic.com/r/2hqa5qo/5 Image 6: Full view of the in-scene-text http://tinypic.com/r/359n7uv/5 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:::: http://dataheadsfontblendingissue.pastebin.com/m6dee606d Code to generate SDL Font Sheet - renders each ascii character with TTF, blits them to main sheet surface http://dataheadsfontblendingissue.pastebin.com/m3a149e29 Code to generate empty sdl rgb surface http://dataheadsfontblendingissue.pastebin.com/m76887541 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