Archived

This topic is now archived and is closed to further replies.

Textures

This topic is 5517 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 have a texture that I would like to use for some simple trees. Some parts of the texture is black (the border) and I don''t want that to show. Can I blend it or something when I render the trees so that only the black parts dissapear? I know some about alpha blending but if I do that the whole texture gets transparent and I want the rest of the texture to be solid. Thanks

Share this post


Link to post
Share on other sites
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_COLOR);
glDepthMask(GL_FALSE);
glbind.....
draw now


and make sure your color is 0 0 0 to be transparent

don t tell me doesn t work when it works i use it as well

Share this post


Link to post
Share on other sites
What Basiror suggested should have worked, did you enable blending before setting the blend function?

glEnable( GL_BLEND ); // I'm sure that's the one.


EDIT: Basiror, grrrrr, got in 9 seconds before i did.

[edited by - GeNe on November 9, 2002 11:58:06 AM]

Share this post


Link to post
Share on other sites
It''s almost working now. All that''s left is the original problem. I want the rest of the texture (the parts that ain''t black) to be solid. The way you showed me makes the black parts go away but it also makes the rest of the texture transparent

Share this post


Link to post
Share on other sites
you need to set glDepthMask(GL_TRUE); when you quit blending

it is used to use the depthbuffer for blending otherwise you had to render your blended polygons from back to front

Share this post


Link to post
Share on other sites