Making a certain color see though?

Started by
10 comments, last by DevLiquidKnight 20 years, 10 months ago
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
Advertisement
You need to add an alpha channel (almost all art programs can do this) to your texture and then use an alpha test (glAlphaFunc).
"...."
alpha test (glAlphaFunc).
Alpha channel? -.- lost me lol
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.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Check out NeHe''s Blending tutorial:

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

Or look up "Alpha Blending" in google.
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
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?
http://www.8ung.at/basiror/theironcross.html
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
You don't need to vote for the "lesser of two evils"! Learn about Instant Runoff Voting, the simple cure for a broken democracy!
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 ...
http://www.8ung.at/basiror/theironcross.html
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 ?

This topic is closed to new replies.

Advertisement