Jump to content
  • Advertisement
Sign in to follow this  
datahead8888

SDL_TTF font open gl blending issue...

This topic is 3317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!