Blending - transparency issue (picture included)

Started by
1 comment, last by gooball 19 years, 11 months ago
Hello! Well I got my text to work finally. (had to disable texture extensions in reverse order: glActiveTextureARB(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_2D); ) Now I have a slightly different issue, my text is displaying, but when displayed against my 3D world, the text really looks transparent. As seen here: My problem is that I need blending enabled to key out any black pixels in the text font bitmap, but the result is that my text is slightly transparent. Is there any way to make my text more opaque? Thanks! [edited by - gooball on May 19, 2004 2:35:12 PM]
Advertisement
Use alpha testing, not blending.
OK, I got it to work.

Thanks Raduprv, you got me thinking about alpha stuff.

I referred to Nehe''s Lesson 20, on Masking.

and the original text rendering is based on Nehe''s Lesson 17.

I have two font bitmaps now:
Font.bmp (Black background, white characters)
FontMask.bmp (White background, black characters)

(and for people searching the forum, with similar problems)
Problems that I had included: My text requires two passes to render, the first using glBlendFunc(GL_DST_COLOR,GL_ZERO); to create a black base for the text using the FontMask.bmp data. Then a second pass using glBlendFunc(GL_ONE,GL_ONE); to place a colored layer based on Font.bmp data.

The problem was that I had glColor4f being called before the first pass, and that was altering the alpha data of the mask, I changed the code to only color the 2nd pass, and it now works.

The second problem was that because I am using glCallLists() to render my text, and I call it twice with both blending passes, the 2nd pass was rendering the text off to the side, at the end of the first line of text made in the first pass.

I solved this by encasing the first pass''s call to glCallLists() in a glPushMatrix/glPopMatrix construct.

This topic is closed to new replies.

Advertisement