Sign in to follow this  
Samsonite

OpenGL Blending in OpenGL using RGBA or similar

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this