transparent background
there is a sprite which is a tga file with alpha channel. it is drawn with transparent background but when load it to Open Gl and try to use it - its background doesn't appear transparent. why?
++could anyone provide a link to good and informative article on sprites. special interest : 2D sidescrollers.
thanx a lot
Assuming your image loading code is providing the alpha as a fourth channel, all you'll need to do is enable blending and provide a suitable blend function, eg
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
then render your sprite as before.
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
then render your sprite as before.
thanx for reply. it was useful.
would like to share some ideas and explain my dismay. i was using a tga loader which reckoned it was able to load all kinds of tga files : 24,32 bit + RLE. but i noticed it could only handle tga files that were of a pretty large size (>=100 Kb).
does anybody know why?
would like to share some ideas and explain my dismay. i was using a tga loader which reckoned it was able to load all kinds of tga files : 24,32 bit + RLE. but i noticed it could only handle tga files that were of a pretty large size (>=100 Kb).
does anybody know why?
I think you should write your own TGA loader. You can also check nehe.gamedev.net for various tutorials on loading files.
And I would go for alpha testing, not alpha blending, when it comes to transparency.
And I would go for alpha testing, not alpha blending, when it comes to transparency.
Quote:Original post by Raduprv
And I would go for alpha testing, not alpha blending, when it comes to transparency.
It totaly depends on the effect you wnat. If you need very shap edges you use alpha testing, but if you need smooth edges use alpha blending (can be combined with testing for speed-up).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement