Advertisement

A QUESTION

Started by June 12, 2002 12:44 PM
8 comments, last by Sashka 22 years, 8 months ago
I have texture with black background, I want to use this texture on the quad , so that the black background won''t be seen. I tryed to use blending but then the texture becomes transparent. I want to remove the black background but to keep texture opaque. Anybody knows how to do it???
A ANSWER. You used blending, why not just turn blending off? Maybe I don''t get what you are asking...
Advertisement
You need to use alpha blending(+alpha testing) not color blending. Add another color component (alpha) and set it to 1.0 where texture should be seen and 0.0 where texture should be transparent.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
I use blending to remove black background, and it works but the whole texture becomes transparent too ( not only the black part).
Read DarkWing''s reply again. You need to set the alpha channel.
I used alpha-blending:

glBlendFunc(GL_SRC_ALPHA,GL_ONE );
Advertisement
Good. Now set the alpha channel as he indicated in whatever image editing software you use.
Also try using One-minus alpha instead of GL_ONE there.
NeHe''s masking tutorial might have what you are looking for.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
Thank you all for your advices! I am now reading 20th tutorial.....

This topic is closed to new replies.

Advertisement