1 # This test case handles a specific task:
2 # to draw 2d objects in same scene with 3d objects while
3 # 2d objects need to be drawn in specific order on 3d plane and
4 # overlap correctly with 3d objects.
8 # Thin boxes represent overlapping 2d objects in same plane
9 # Normally such configuration would cause z-fighting noise (flickering)
10 box b1 -0.75 -0.75 0 1 1 0.01
11 box b2 -0.5 -0.5 0 1 1 0.01
12 box b3 -0.25 -0.25 0 1 1 0.01
16 vsetmaterial b2 silver
17 vsetmaterial b3 copper
22 # Create new z-layer for 3d objects
28 # Disable OpenGl depth test for layer 0 (to eliminate flickering)
29 # But depth write is still enabled
30 vzlayer disable depthtest 0
32 # Disable depth buffer clearing for layer 1 (we want correct overlapping with 3d objects)
33 vzlayer disable depthclear 1
35 # List currently enabled settings of each layer
39 # "3d" box with one of its faces on same plane with "2d" objects
40 # Normally this also would cause flickering because new box is
41 # supposed to be in layer 1 as "3d" structure, thus depth test between
42 # new box and "2d" objects will be enabled.
43 box b 0 0 0.01 0.5 0.5 -0.5
47 # To handle this situation, depth offset setting was introduced.
48 # It implemented with glPolygonOffset calls per layer.
49 vzlayer enable positiveoffset 1