Transparency / Translucency
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
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.
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.
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
-THACO
.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
~Urayami
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement