0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
[occt.git] / tests / bugs / vis / bug24785
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.
5
6 pload ALL
7 vinit
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
13 vdisplay b1
14 vdisplay b2
15 vdisplay b3
16 vsetmaterial b2 silver
17 vsetmaterial b3 copper
18
19 psphere s 0.3
20 vdisplay s
21
22 # Create new z-layer for 3d objects
23 vzlayer add
24 vobjzlayer set s 1 
25
26 vsetdispmode 1
27
28 # Disable OpenGl depth test for layer 0 (to eliminate flickering)
29 # But depth write is still enabled
30 vzlayer disable depthtest 0
31
32 # Disable depth buffer clearing for layer 1 (we want correct overlapping with 3d objects)
33 vzlayer disable depthclear 1
34
35 # List currently enabled settings of each layer
36 vzlayer settings 0
37 vzlayer settings 1
38
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
44 vdisplay b
45 vobjzlayer set b 1 
46
47 # To handle this situation, depth offset setting was introduced.
48 # It implemented with glPolygonOffset calls per layer.
49 vzlayer enable positiveoffset 1
50
51 vfit