On Jul 7, 2004, at 6:11 PM, chun lee wrote:
But don't you have to switch the rendering off and on again for the new rendering order to get effect? What was in my mind is that say both of the cubes are in a global rotation so that sometimes A is in front and other times B is in front.
So there is no way to do this in openGL?
The alpha blending is done using the fragment unit, which requires all of the geometry to be rendered to 2D. The blending functions take the pixels already in the pixel buffer and apply the transform, so obviously the pixels have to exist in the buffer before the transform happens.
This is an age old problem, and while solutions exist, there is no
ideal one. Probably the most accurate way to handle this involves the
construction of a b-tree for sorting the geometry before rendering.
This is pretty much impossible with the way GEM is structured currently
since each Geo object directly renders using immediate mode GL calls,
and thus has no knowledge of any other Geos in the scene. There might
be a way to do this with vertex-array rendering since that does not use
immediate mode, and the vertex data is exposed and manipulatable.
If you are directly feeding in matrix transform info using translate then it would be possible to change render order on the fly to do front to back rendering.
cgc
Cheers
CHUN