Jump to content
  • Advertisement
Sign in to follow this  
sd_dracula

transparency and textures

This topic is 4076 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 an image of a blue sky with white clouds. i'm trying to map that to a cube and i want the blue to be totally transparent such that only the clouds can be seen. i checked out NeHe's site but the way tranparency its done there is by a precentage like this: glColor4f(1.0f,1.0f,1.0f,0.5f); // Full Brightness, 50% Alpha ( NEW ) glBlendFunc(GL_SRC_ALPHA, GL_ONE); // Blending Function For Translucency Based On Source Alpha Value ( NEW ) can anyone help? thanks

Share this post


Link to post
Share on other sites
Advertisement
Im not sure but an image is an image... one change to the clouds would affect the blue and vice versa.

I have been looking for a good way to fix a similar "problem".

Share this post


Link to post
Share on other sites
Well, you have a few options:
You can add logic on your texture load that will set the alpha channel to be low for blues.
Photoshop your image, delete out the blue, and save it as 32bit image (with alpha channel).
Once you have a image with an alpha channel you can use the following blendFunc: glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)

You will find it’s best to be good with a decent image editing software to change textures before the load to fit your needs rather than finding workarounds in your code.

Share this post


Link to post
Share on other sites
Well you need an image that supports transparency. glColor4f(...) just sets every color in the image to be .5 alpha.

Share this post


Link to post
Share on other sites
thanks.
my photoshop skills arent too advanced i'm afraid.
i know how to save the picture as a 32bit image but dont know how to set the alpha channel. how do i do that?
and one last thing, i managed to get a few white clouds on top of a black background and only the clouds show up which is wht i wanted. but for some reason they're transparent a bit too even though i havent turned that on.
any idea whats wrong there?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!