Archived

This topic is now archived and is closed to further replies.

Eber Kain

Makeing a specific color clear?

Recommended Posts

Eber Kain    130
I know you can do this somehow, any help on the subject? I could do alpha and acheve the same affect, but if i could just make one color clear, then It would be easier for my sprite based stuff. When he''s best, he''s little worst than a man, When he''s worst, he''s little better than a beast.

Share this post


Link to post
Share on other sites
Wavarian    850
Using alpha channels is the easiest way to go. Once you''ve read your image data, before uploading it to opengl, re-read the colour data, and if you come by say R = 0; G = 0; B = 255 then set A = 0 (if you wanted blue to be ignored). otherwise for all other colour combinations, use A = 255;

Upload the texture to opengl, enable blending, and voila.. done.

Share this post


Link to post
Share on other sites
Eber Kain    130
Im useing Devil to load textures, the simplest way for me would be to set it up so it renders some odd color clear.

When he''s best, he''s little worst than a man,
When he''s worst, he''s little better than a beast.

Share this post


Link to post
Share on other sites
Wavarian    850
This is one reason why you shouldnt use libraries to do something that you can do just as easily yourself, but with greater accessibility and knowledge of what the code does.

What image format are you loading? Jpeg & tga files are easy to read yourself. Ive never used a library to load textures.. Is there no way that you can access the texture''s raw image data before it gets sent to opengl?

Share this post


Link to post
Share on other sites
Eber Kain    130
I can access the textures data before its sent to OpenGL, but what I want to do is set up a color so that OpenGL renders it clear. I realize that there are several different ways i can acheve the same affect. I want to do it this way.

Would useing an alpha channel be faster? Seems like it would have to be slower because it has to access more memory. Anyhow this is just a little test project.

When he''s best, he''s little worst than a man,
When he''s worst, he''s little better than a beast.

Share this post


Link to post
Share on other sites