View Full Version : texture alpha
12-28-2001, 04:08 AM
I'm trying to write my own version of NEHE's tutorial 19 (the one about particles) but my particles "chew up" the others behind them. The black area of the bitmap hides the particles that are behind it, so my question is how do I enable the texturing alpha? I enabled blending (glEnable(GL_BLEND)), but that didn't make any difference.
I had the same problem some time ago and I solved it by setting glDepthMask(GL_FALSE) so
that the particles canīt cover each other any more.
But you could also use glAlphaFunc to delete the Pixels ,but this sometimes looks very bad:
Only fragments with alpha > 0.95f will pass.
Well perhaps I havenīt understand you correct.Your texture has no alpha value at
all ,or what do you mean with black area?
If so you donīt use GL_RGBA which includes
an alpha value ,but GL_RGB as the external
Could you send your code to create the texture?
12-30-2001, 01:51 PM
Yeap, what Phil has written is the right
way for doing alphatesting. For alphablending
simply additional call glEnable(GL_BLEND).
Your particles you should in general sort by
depth, calculate the distance from the
observer to the particles center and sort
them by quicksort then. Then draw them from
back to front. If you have just hard edges
and no transparent particles...what I don't
believe, because such edgy particles would
look awful...then you don't need that
sorting, but also have to let blend disabled.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.