Skip to main content
GameDev.net gamedev.net
🔒 Locked

transperency problem

Started by hello_there Nov 23, 2003 at 6:46 PM 6 replies 650+ views
Original Post
hello_there
hello_there
i''m using a 32 bit targa file for my graphics and I have a texture for the mouse pointer. I do this to get the transperency glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0); //draw quad glDisable(GL_ALPHA_TEST); it works but around the none transperent bit it goes white. how do i stop it from doing that?.
____________How could hell be worse?
hello_there
hello_there
I tried this as well but it put the back ground colour around the edges instead of the texture that''s behind it.

glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

//draw quad

glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);

how do you make it work properly
____________How could hell be worse?
Digitalfragment
Digitalfragment
Make sure that the texture was saved to video memory with the Alpha channel included (ie, GL_RGBA not GL_RGB) and dont bother with an Alpha Test, just:

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable ( GL_BLEND );

drawMy1337Quads();

glDisable ( GL_BLEND );
hello_there
hello_there
how do you make sure it''s saved to video memory. does the texture behind it also have to be saved as GL_RGBA?
____________How could hell be worse?
NordFenris
NordFenris
make sure you call glTexImage2D with GL_RGBA, and no, the texture behind it can be GL_LUMINANCE or whatever.
hello_there
hello_there
does gluBuild2DMipmaps do the same thing because if if does that what i''m doing and it still doesn''t work.
____________How could hell be worse?
hello_there
hello_there
anyone have any idea what i might be doing wrong?
____________How could hell be worse?
hello_there
hello_there
never mind i''ve found out what i did wrong.
____________How could hell be worse?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.