Z-test without afecting the z-buffer

Can I use glDepthMask to draw smoke (as particles) when I don’t wanna sort they?:
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);

glBindTexture(GL_TEXTURE_2D, GLuint);
glBegin(GL_QUADS);
// draw particles (not from back-to-front)
glEnd();

glDepthMask(GL_TRUE);
glDisable(GL_BLEND);

Will be all particles blended visibly.
(Sorry - Language problems)

Well, what happens if you try it? If it works, then it works. If it doesn’t work, then it doesn’t work.

Some blending functions require depth soring, others don’t. Since you didn’t say what function you use, I can’t say if you have to sort or not.

I haven’t it tested, I’m now in a internet coffe (I don’t have web at home). I wrote to this page because I see this function 1st time in my life and I don’t know exatcly what how work it.
I use glBlendFunc(GL_SRC_ALPHA, GL_ONE);

Oh, yeah, I forget. How can I sort my particles quick. They are struct types:
struct Particle {
GLfloat x, y, z; // position
GLfloat vx, vy, vz; // vector
… };
And they’re stored in a std::set object.

Additive blending doesn’t need sorting, so it should work by disabling depth writes and just draw everything.

One more question. If my particles are black and alpha is in range 0-255 (in texture). Will be they visible in the scene (as a black smoke)?

With that blending function; no. You’re adding zero (black) to the frame buffer, which does nothing to the color in the frame buffer.

I’m not sure I remember correct, but I think you can do it with interpolation instead of additive blending; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). This blending function usually requires sorting to work properly, but in this case you can get it to work without sorting. I did it like this before, and it worked great. This way, you can use the alpha channel as the thickness of the smoke, and the color channel as the color of the smoke.

Ok, thanks. And what if I use:
glBlendFunc(GL_SRC_ALPHA, GL_ZERO);

That is like having blending disabled. GL_ZERO will cause nothing of the frame buffer to show through the smoke, independent of the alpha value.

I suggest you take a real look at the blending operation; what the blending equation really does and how the blending factors affect the equation. the Red Book , chapter 7, is a good start.