Jump to content
  • Advertisement
Sign in to follow this  
Samsonite

OpenGL Blending in OpenGL using RGBA or similar

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

Hello! I was wondering how to do keycolor-blending in OpenGL and SDL. Picture below will illustrate what I mean: It's the parts with the ghastly pink color I want blended. Shall I use this code?
glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE);
Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
You mean for transparency? I think you should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and add an alpha channel to your texture, manually setting the A value to 0 if the RGB values are 1,0,1 before calling glTexImage.

You could also use PNG files which can store an alpha channel, giving you more flexibility.

I assume there is probably a way to do it with indexes and a palette but I've never done it that way.

[Edited by - Kwizatz on November 6, 2006 1:37:14 PM]

Share this post


Link to post
Share on other sites
Ok, do I have to use Photoshop to set the alpha channels if I so chose to use .PNG files? Or can I do it in paint?

Thanks alot for your answers so far.

Share this post


Link to post
Share on other sites
Quote:
Original post by Samsonite
Ok, do I have to use Photoshop to set the alpha channels if I so chose to use .PNG files? Or can I do it in paint?

Thanks alot for your answers so far.


You can use The Gimp if you don't have Photoshop, here is how to set and use a Layer Mask to add transparency to your images using the Gimp.

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!