Jump to content
  • Advertisement
Sign in to follow this  
golgoth

Texture Transparency!

This topic is 4903 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

hi all! it must be an easy solution for this one... i just want an opacity on a texture map... to allow the underlying color of the primitive to show through... no need to use alpha channel... only a level of opacity on the texture where i can still see the mesh underneath 100% opac. the gl fac they came up with: use glTexEnv(), and set the texture environment mode to GL_BLEND. In this case, you'd want to leave the texture environment color to its default value of (0,0,0,0). well, so far with those 2 lines: glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND); glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, l_texture->GetBlendColor()); im getting kind of inverse color of the texture... the alpha value doesnt seam to do anything... what am i missing here? thx

Share this post


Link to post
Share on other sites
Advertisement

If your color is working... on the map... but the alpha is not working with the background I think putting this in there might help a bit.

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

I hope this helps...

Share this post


Link to post
Share on other sites
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

will affect the vertices... i only want the texture to be tranceparent!

hope we dont need multipass to do this...

Share this post


Link to post
Share on other sites
OK... I re-read the post. So basically your not doing alpha blend... ooops...

What part of the color looks messed up. The color inside the (0,0,0,0) or outside?

I hope im understanding this right...

Share this post


Link to post
Share on other sites
actualy if a pass a color lets say 0,0,0,0.5 or 1,1,1,0.5 (im not sure)

i want my texture to be 50% transparent

if we do 1,1,1,1

will see the textuire 100%

if we do 0,0,0,0 the texture will be invisible but will still see the mesh 100%!

a texture opacity basicly!

Share this post


Link to post
Share on other sites
I don't know of any simple ways to do this, but I do know that it can be done in just a few lines of code with multi-texturing or with a fragment program. I would recommend biting the bullet and learning how to use multi-texturing. It'll only take up one evening of screwing around with the OpenGL extension registry to figure it out and it will be a worthwhile skill to have. Another option would be to learn GLSL. This would take a lot more of your time, but the benefits are much greater (you can texture much more flexibly with a fragment program than with register combiners).

Share this post


Link to post
Share on other sites
after experiencing alot with combiners... i got this to work:

glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, l_texture->GetAlpha());
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE);

works pretty good actualy... but for some reson i doubt its the right way to do it!

GLSL... any good place you can refer to start with?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!