Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


GL_DEPTH_TEST/GL_BLEND issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Spacekangaroo   Members   -  Reputation: 100

Like
0Likes
Like

Posted 29 February 2012 - 05:28 PM

Hey guys, small problem I'm having.

Been following Nehe's tutorial for particle effects and I've built a fireball for my game, however the issue I'm having is that I have to disable GL_DEPTH_TEST for it to look good - otherwise the particles won't blend over one another, only the environment they appear over.

Posted Image

So I'm trying to make sense of why this is happening? it's textured and blended.

The blend function I'm using is glBlendFunc(GL_SRC_ALPHA,GL_ONE);

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8616

Like
0Likes
Like

Posted 29 February 2012 - 06:18 PM

If you have the depth test enabled, then particles with occlude each other since the depth buffer is binary and has no concept of transparency. The blending function you use does not require back-to-front sorting, but you need to ensure that particles don't occlude each other. If you disable the depth test, then nothing will occlude the particles (not even things that should occlude them). Another option is to keep depth test enabled, but disable depth writes. That ensures that the environment occludes the particles, but the particles don't update the depth buffer so they never occlude themselves. Look up glDepthMask.

#3 Spacekangaroo   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 March 2012 - 08:20 AM

glDepthMask works great! cheers :D




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS