Jump to content
  • Advertisement

Archived

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

DevLiquidKnight

Making a certain color see though?

This topic is 5497 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 am trying to figure out how to make the color of like the bight pinkish/purplish color transparent using open GL and C++ anyone know how to set this up? Or the basic commands of making it trasparent? coder requires 0xf00d before continue().
Killer Eagle Software

Share this post


Link to post
Share on other sites
Advertisement
colors are stored as color components on a PC... for example, the pixels you see with bitmaps and such have a RED, GREEN, and BLUE channel (the values of these channels blend to form all the colors available).

some graphics file formats (and textures in OGL) have an ALPHA channel also, which is another channel that determines how transparent that pixel is.

by adding an alpha channel to your graphics, you can have parts be clear, or slightly see-through.

hope that helps.

PS - if you only want to have some parts completely clear, and the rest regular, you can also use MASKING instead of the alpha stuff, see the tutorials on nehe.gamedev.net to see how to do this.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Check out NeHe''s Blending tutorial:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08

Or look up "Alpha Blending" in google.

Share this post


Link to post
Share on other sites
glColor4f(1.0f,1.0f,1.0f,0.5f);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);

is this how blending is done and glColor4 the 4th is the alpha value and the blend function I am completely lost on.... But its not that i want to blend the whole thing just a specific color im lost :/ lol

coder requires 0xf00d before continue().

Killer Eagle Software

Share this post


Link to post
Share on other sites
just found this old topic and i d still know if it is possible to get rid of one specific color

maybe an extension or what ever

any idea?

Share this post


Link to post
Share on other sites
quote:
Original post by Basiror
just found this old topic and i d still know if it is possible to get rid of one specific color

maybe an extension or what ever

any idea?


Write a loader that inserts a fourth channel into the image and set the value of the fourth channel to zero when the RGB color a pixel is equal to the color you wish you set transparent. You''ll want to check the syntax you use to register your texture with OpenGL to ensure that it recognizes that the image contains an alpha channel, and you need to turn on certain settings when rendering while using the texture in order to utilize the transparency - I believe that is accomplished with alpha testing.

That "bright pinkish/purplish" color is known as Magenta. For your information, magenta is the highest possible combination of red and blue, Cyan is the highest possible combination of blue and green, and Yellow is the highest possible combination of red and green.


"Last time, I asked: ''What does mathematics mean to you?'' And some people answered: ''The manipulation of numbers, the manipulation of structures.'' And if I had asked what music means to you, would you have answered: ''The manipulation of notes?''" - S. Lang

Share this post


Link to post
Share on other sites
actually i was asking for a renderwise solution

if i d write such a loader it write a convertor and spare some time while loading maps ...

Share this post


Link to post
Share on other sites
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=38
This tutorial demonstrates what I want to do it seems as if the color black is seen as transparent im just not sure how its done... Ive looked though code just kinda still lost ?

Share this post


Link to post
Share on other sites

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