Help with Draw Order - is it Possible?

Started by
1 comment, last by neonfaktory 20 years, 6 months ago
My scene consists of a flat grid, billboarded particles (the ''bullets''), and 3D game objects (players/enemies). The grid is just a quad with a semi-transparent grid-texture on it. The Particles are billboarded, semi-transparent texture mapped quads. And finally, the Player/Enemies are simple 3D Objects. Now, everything happens "on" the grid. So this means, as you may have geussed, that the 3D Objects are "chopped" in half by the grid. I actually work with this idea by splitting the models and having the halves "hover" and sway above the grid on both sides. Anyway, this means my billboarded particles, also in line with the grid, are chopped in half by it as well, which is not a pretty look - this is the problem. My immediate solution was to draw the grid first, then draw the particles afterwards with depth testing disabled, then re-enable depth testing, and then draw the ships. However, the problem with this draw order is that I need to draw the ships before the grid in order to have the transparent elements of the grid work properly with the ships, which appear on both sides of the grid. SO, the obvious flaw is that I need to draw the ships before the grid, the particles before the ships, but at the same time the particles after the grid, as far as I can see. I was hoping someone could enlighten me to something I can''t see, in order to get the effect I want . Thanks for any help.
weee!
Advertisement
Try to post a screenshot.

Height Map Editor | Eternal Lands | Fast User Directory
Hi
This?
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
draw particles
glDisable(GL_BLEND);

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5);
draw grid
glDisable(GL_ALPHA_TEST);

draw 3d objects
byee
============================== Videoman Library Project

This topic is closed to new replies.

Advertisement