RGBA

Started by
1 comment, last by SoD 22 years, 8 months ago
i need to display an image with a black background (it contains the title of my game) on the screen make the black invisible and not the text in the image trasparent. i decided to not use GL_BLEND but only GL_ALPHA_TEST with glAlphaFunc(GL_GREATER,0.0f) but the image rendered is with the black background. with the blend function the black disappears but i the text is semi transparent and bad looking. i use a TGA image file loaded with the code of Nehe without the compression. reading the code and the tutorial i''ve seen that with only TGA files with 32 BPP we can load the texture with the RGBA format. in 24BPP only RGB. So,i''ve tried to convert the image in 32BPP but none of my programs support 32 bit TGA files, only 24 max (Paint Shop Pro,IrfanView,etc).. Nehe in his tutorial says about 32 bpp tga files.. it''s true? how can i load this image correctly and render it ? the code for rendering is : glBindTexture(GL_TEXTURE_2D, texture_obj.ID); glEnable(GL_TEXTURE_2D); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER,0.0f); glBegin(GL_TRIANGLE_STRIP); glTexCoord2i(0,0); glVertex2i(10,485); glTexCoord2i(1,0); glVertex2i(210,485); glTexCoord2i(0,1); glVertex2i(10,410); glTexCoord2i(1,1); glVertex2i(210,410); glEnd(); I''ve tried all the possible options for AlphaFunc and Blend... help me!!!! :°(°°°
Here we go!
Advertisement
Paint shop pro (at least version 7) can save 32bit Targa''s. Here''s who you do it:
  • Mask->New->Hide All or Show All
  • Mask->Edit
  • Draw the mask
  • Mask->Save to Alpha Channel
  • Ok
  • Now save it as a 24bit Targa, it will actually be 32bit
  • I agree, that is a weird way to do it


[Resist Windows XP''s Invasive Production Activation Technology!]
It''s works but it''s a little difficult to modify correctly the borders of the text in the image thanks!
Here we go!

This topic is closed to new replies.

Advertisement