particles visible through my objects

I am writing a space trading game.

I have space ships, which leave a trail of alpha blended particles in their wake, from their exhaust ports, and I am using Nehe’s particle example as the basis of my code.

I notice, that to get the plasma/blending effect, Nehe, disables the depth buffer as the particles are drawn.

Unfortunately, this has a strange effect in my game code, as the ships pass behind planets, their exhaust trails are visible through the planet, but the ship is not.

Basically, the order I draw things in is:

  1. Draw starfield
  2. draw all planets
  3. for each ship:
    {
    disable depth test
    draw exhausts
    enable depth test
    draw the ship.
    }

I know this is incorrect, and if I leave the depth test on throughout, my nice plasma effect goes…

what should be the correct drawing order?

dd

Reorder it like this:

Draw starfield
enable depth test
draw all planets
for each ship:
{
draw the ship.
}
glDepthMask(GL_FALSE)
for each ship:
{
draw exhausts
}
glDepthMask(GL_TRUE)

Tried that and it WORKS yippee!!!

thanks.