Skip to main content
gamedev.net
🔒 Locked

Textures

Started by ArchMiffo Nov 9, 2002 at 9:05 AM 6 replies 350+ views
Original Post
ArchMiffo
ArchMiffo
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
Basiror
Basiror
glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_COLOR);

removes all black pixels
http://www.8ung.at/basiror/theironcross.html
ArchMiffo
ArchMiffo
Nope, it didn''t
Basiror
Basiror
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
http://www.8ung.at/basiror/theironcross.html
GeNe
GeNe
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]
ArchMiffo
ArchMiffo
If I set glDepthMask(GL_FALSE); I can''t see anything. And if I don''t the whole texture becomes transparent. Any idees?
ArchMiffo
ArchMiffo
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
Basiror
Basiror
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
http://www.8ung.at/basiror/theironcross.html

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.