glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glDepthFunc(GL_LEQUAL); // Type Of Depth Testing
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable Alpha Blending (disable alpha testing)
glEnable(GL_BLEND); // Enable Blending (disable alpha testing)
//glAlphaFunc(GL_GREATER,0.1f); // Set Alpha Testing (disable blending)
//glEnable(GL_ALPHA_TEST); // Enable Alpha Testing (disable blending)
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glEnable(GL_CULL_FACE); // Remove Back Face
Problem with Alpha channels in TGA files
Hey guys, i have made my own custom font (TGA with alpha channel) on white background, but it does not show up correct (that is, the alpha channel is taken, but with a little bit of background round the alpha channel).
My guess is because the texture is resized, and i don''t have a correct initialization. This is my init routine:
Maybe you set your alpha channel to black?
Though I do
glBlendFunc(GL_SRC_ALPHA,GL_ONE);// Type Of Blending To Perform
for black background.
Cheers.
" Do we need us? "
Though I do
glBlendFunc(GL_SRC_ALPHA,GL_ONE);// Type Of Blending To Perform
for black background.
Cheers.
" Do we need us? "
" Do we need us? "Ionware Productions - Games and Game Tools Development
I think you''re supposed to use the alpha test and use glAlphaFunc somehow...
Firebird Entertainment
Firebird Entertainment
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Assuming that your font is to be solid-color, your color channels should amount to all white (everywhere, if I didn''t make that clear). The alpha channel should be the only channel to contain any value variance--to define the font.
The trick is that OpenGL interpolates the colors between the pixels on your font texture. This also means the alpha value. That''s why blending doesn''t work very well and you get edges around your font.
What you could do is draw the font without blending but with alpha testing enabled using glAlphaFunc(GL_EQUAL, 1.0f);
Now, only stuff with an alpha of 1.0f (meaning your font) gets drawn. All other stuff is dropped by the GPU.
- An eye for an eye will make the world go blind -
What you could do is draw the font without blending but with alpha testing enabled using glAlphaFunc(GL_EQUAL, 1.0f);
Now, only stuff with an alpha of 1.0f (meaning your font) gets drawn. All other stuff is dropped by the GPU.
- An eye for an eye will make the world go blind -
<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement