Jump to content
  • Advertisement

Archived

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

THACO

Transparency / Translucency

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

This is probably a silly question, but im having a problem with nehe tutorial number 9, im trying to understand in more detail the blending function of opengl. Im not sure if i am understanding this correctly, but the tutorial makes the black part of the .bmp completely transparent. Well I want to have .bmps to have black in them, and say use bright pink (255,0,255) or (1.0,0.0,1.0) as the leftover pieces of the texture that i do not want to see. Do i have to use glTexEnv to do this? -THACO

Share this post


Link to post
Share on other sites
Advertisement
TexEnv() only controls how the fragment color is affected.

BlendFunc() controls how the frame buffer is affected by the incoming fragment.

It''s really important to understand the difference between fragment coloring (lighting, texture environment application) and framebuffer blending.

To have a texture that can be transparent, or can have color, you typically use the blend function (GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) and make the alpha value of the texture (and thus, usually, fragment) 1.0 where you want opacity, and 0.0 where you want transparency.

Share this post


Link to post
Share on other sites
Ok, i used that before the GL_SRC_ALPHA and such, but it was not working, which i gather now is because that uses the specific alpha from the texture itself, since i took the texture from the lesson9 it has black as alpha color. I have never been good with texture programs and just use paint to create crappy textures, is there a free program i can use that can set the alpha color of a .bmp? and is this what i have to do?


-THACO

Share this post


Link to post
Share on other sites
.BMP files don''t have an alpha value (at least, the standard ones do not). What you could do is make your own bmp loader, which would allow you to load a .bmp and then add your own alpha. It seems, though, that you want a simpler solution. IrfanView is a good, free image program that you can use to create graphics with internal alpha values (.TGAs for instance). I''d probably say more, but I''m in a bit of a hurry now. Hope this helps.

~Urayami

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!