Partly transparent textures (and planes)


I am not sure if there is a word for what I am trying to do. What I am trying to do is to map a texture on a rectangular plane (which works). But I want to be the texture and the plane to be partly transparent to form randomly formed objects.

I think that I could use the alpha value to do this.
But how do I generate and store the alpha values for existing textures. Are there any simple examples for this? Or is there perhaps a better way to do this?

Thank you for all replies,


Use RGBA texture format and for some texels set their alpha values to be 0 to make them opaque, some as 0.5 (translucent)
and some as 1.0

or you can use some sort of mask or a second texture designed such as when blended with the first texture gives the desired effect.

Thanks, I set the alpha value of the texture to transparent in some parts.

How do I have to set up the other parameters: glTexImage and glTexEnv

Thank you for your help.


What I am searching is something like this:

(found on

Do you know code examples to generate sth. like this?

I have transparent effects now, but the problem is, that the effect I have is always affects the whole image.
I just want to habe partly transparent images. I set the alpha values in this way:

for(int i = 0; i < 256; i++)
for(int j = 0; j < 256; j++)
data2[i*256*4+j*4+0] = data[i*256*3+j*3+0];
data2[i*256*4+j*4+1] = data[i*256*3+j*3+1];
data2[i*256*4+j*4+2] = data[i*256*3+j*3+2];
data2[i*256*4+j*4+3] = (BYTE)255;
if(j > 128) data2[i*256*4+j*4+3] = (BYTE)0;

data is a RGB image.

Someone got an idea?

The figure you drew is called Billboarding. For tutorial on this refer to

Try RGBA instead of RGB. The code above does not have effect if your format is RGB.

Assuming you want to rotate your texture mapped rectangle then you can set your rectangle’s metallic properties ( Ch 5 red book) where when a side of it moves away from fixed light position, can fade and the one that is near is bright.

Thank you for the help. Now it works. I think it was a problem of OpenGL settings. I will check it later.

I have been at least ten times on the billboard page you posted but only read the first line: " Billboarding is a technique that adjusts an object’s orientation so that it “faces” some target, usually the camera. " So I thought it is a kind of camera adjusting… :wink:

The code I posted is for making RGBA out of RGB.

Now it works… yepie!

I’ve the same problem. I want to fade in text with transparent background ( or tree same as above ) Now I get all texture region white instead of only seeing the white writing(tree whatever)
Could you give me some code snippets for help?
Many thanks