5 #######################################################################
6 # Extend OpenGl_Context to store map of shared GPU resources
7 #######################################################################
12 # This test is modified test cdl/934/C2
15 # this test performs automatical test of primitives array objects by pixel checking
16 # this test ALSO DUMPS two result images (the primitives on the images should have
17 # same contours, WIREFRAME OBJECTS ARE IN YELLOW-RED COLORS, SHADED OBJECTS ARE
20 set BUGNUMBER OCC22583
22 set ImageName1 "occ22583-image1.png"
23 set ImageName2 "occ22583-image2.png"
25 # set window width and height, this values should correspond to a
26 # view window sizes to pass the test
30 # colors used for tests
51 # limit of range where the pixels are tested (sets number of iterations)
52 # 30 pixels in width and in height will be enough to test all primitives
56 # this procedure is internal and will be removed at the end of the script
57 # generate points for primitive
58 proc generate_points {x y z r g b} {
59 # define top plane points
60 global pts01 pts02 pts03 pts04 pts05 pts06
61 set pts01 "v [expr "$x-5"] [expr "$y+5"] [expr "$z"] n 0 0 -1 c $r $g $b"
62 set pts02 "v [expr "$x "] [expr "$y+5"] [expr "$z"] n 0 0 -1 c $r $g $b"
63 set pts03 "v [expr "$x "] [expr "$y "] [expr "$z"] n 0 0 -1 c $r $g $b"
64 set pts04 "v [expr "$x+5"] [expr "$y "] [expr "$z"] n 0 0 -1 c $r $g $b"
65 set pts05 "v [expr "$x-5"] [expr "$y-5"] [expr "$z"] n 0 0 -1 c $r $g $b"
66 set pts06 "v [expr "$x "] [expr "$y-5"] [expr "$z"] n 0 0 -1 c $r $g $b"
69 # this procedure is internal and will be removed at the end of the script
70 # check pixels of primitive
71 proc check_primitive {name1 r g b args} {
72 global limit_x limit_y view_width view_height
73 # show only primitive that we interested in to test
78 # move cursor not to select shape
82 # test pixels in a top left corner
85 for {set i 0} {$i < $limit_x} {incr i} {
86 for {set j 0} {$j < $limit_y} {incr j} {
87 set QATestVar [ catch { QAGetPixelColor $i $j $r $g $b } ]
88 if { $QATestVar == 0 } {
93 if { $HasPixel == 1 } {
94 set TestPassed [expr $TestPassed + 1]
99 # test pixels in bottom left corner
101 for {set i 0} {$i < $limit_x} {incr i} {
102 for {set j 0} {$j < $limit_y} {incr j} {
103 set QATestVar [ catch { QAGetPixelColor $i [expr $view_height-$j] $r $g $b } ]
104 if { $QATestVar == 0 } {
109 if { $HasPixel == 1 } {
110 set TestPassed [expr $TestPassed + 1]
115 # test pixels in center right corner
117 for {set i 0} {$i < $limit_x} {incr i} {
118 for {set j 0} {$j < $limit_y} {incr j} {
119 set QATestVar [ catch { QAGetPixelColor [expr ($view_width-$limit_y) + $i] [expr ($view_height-$limit_y)/2 + $j] $r $g $b } ]
120 if { $QATestVar == 0 } {
125 if { $HasPixel == 1 } {
126 set TestPassed [expr $TestPassed + 1]
131 # test pixels in center left corner (shouldn't be anything)
133 for {set i 0} {$i < $limit_x} {incr i} {
134 for {set j 0} {$j < $limit_y} {incr j} {
135 set QATestVar [ catch { QAGetPixelColor [expr $view_width/4 + $i] [expr ($view_height-$limit_y)/2 + $j] $r $g $b } ]
136 if { $QATestVar == 0 } {
141 if { $HasPixel == 1 } {
144 set TestPassed [expr $TestPassed + 1]
147 # show all primitives
153 if { ${TestPassed} == 4 } {
160 # ### THIS IS THE HEAD LOOP OF THE TEST ####################
161 # During this test primitives are created and displayed
162 # with commands vdrawparray, and verified for consistency
163 # with check_primitive procedure. In spite of the fact that there
164 # a lot of code below, it's similar and divided on the similar
166 # The iteration loop is intended to check primitives with
167 # "vertex buffer objects" turned off (vbo_enable = 0) and
168 # turned on (vbo_enable = 1)
170 for {set vbo_enable 0} {$vbo_enable < 2} {incr vbo_enable} {
172 if { $vbo_enable == 0 } {
174 puts "TEST WITH VBO is OFF"
176 if { $vbo_enable == 1 } {
178 puts "TEST WITH VBO is ON"
185 # this points are only to simplify visiual check of dumped image
187 vpoint point2 -145 0 0
189 # ****************************** Graphic3d_ArrayOfPoints ****************************** #
190 puts "Graphic3d_ArrayOfPoints: TEST"
194 generate_points 60 0 0 $colorY_R $colorY_G $colorY_B
195 eval vdrawparray pt01 points $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06
197 # ****************************** Graphic3d_ArrayOfSegments ****************************** #
198 puts "Graphic3d_ArrayOfSegments: TEST"
202 generate_points 50 0 0 $colorY_R $colorY_G $colorY_B
203 eval vdrawparray seg01 segments $vbo_enable $pts02 $pts01 $pts01 $pts03 $pts03 $pts05 $pts05 $pts06 $pts06 $pts04 $pts04 $pts02
207 generate_points 40 0 0 $colorR_R $colorR_G $colorR_B
208 eval vdrawparray seg02 segments $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 1 e 2 e 2 e 4 e 4 e 6 e 6 e 5 e 5 e 3 e 3 e 1
210 # ****************************** Graphic3d_ArrayOfPolylines ****************************** #
211 puts "Graphic3d_ArrayOfPolylines: TEST"
215 generate_points 30 0 0 $colorY_R $colorY_G $colorY_B
216 eval vdrawparray pline01 polylines $vbo_enable $pts02 $pts01 $pts03 $pts05 $pts06 $pts04 $pts02
220 generate_points 20 0 0 $colorR_R $colorR_G $colorR_B
221 eval vdrawparray pline02 polylines $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 2 e 4 e 6 e 5 e 3 e 1 e 2
225 generate_points 10 0 0 $colorY_R $colorY_G $colorY_B
226 eval vdrawparray pline03 polylines $vbo_enable ( b 3 ( $pts02 $pts01 $pts03 )), ( b 4 ( $pts03 $pts05 $pts06 $pts04 )), ( b 2 ( $pts04 $pts02 ))
228 # 4: verticies, bounds and edges
230 generate_points 0 0 0 $colorR_R $colorR_G $colorR_B
231 eval vdrawparray pline04 polylines $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 ( b 4 ( e 2 e 1 e 3 e 5 )), ( b 4 ( e 5 e 6 e 4 e 2 ))
233 # ****************************** Graphic3d_ArrayOfTriangles ****************************** #
234 puts "Graphic3d_ArrayOfTriangles: TEST"
238 generate_points -10 0 0 $colorB_R $colorB_G $colorB_B
239 eval vdrawparray t01 triangles $vbo_enable ( $pts03 $pts02 $pts01 ) , ( $pts03 $pts04 $pts02 ) , ( $pts04 $pts03 $pts06 ) , ( $pts06 $pts03 $pts05 )
243 generate_points -20 0 0 $colorG_R $colorG_G $colorG_B
244 eval vdrawparray t02 triangles $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 6 e 3 e 5 e 6 e 4 e 3 e 1 e 3 e 2 e 2 e 3 e 4
246 # ****************************** Graphic3d_ArrayOfTriangleFans ****************************** #
247 puts "Graphic3d_ArrayOfTriangleFans: TEST"
251 generate_points -30 0 0 $colorB_R $colorB_G $colorB_B
252 eval vdrawparray tfan01 trianglefans $vbo_enable ( $pts02 $pts01 $pts03 $pts04 )
253 eval vdrawparray tfan02 trianglefans $vbo_enable ( $pts03 $pts05 $pts06 $pts04 )
255 # 2: bounds and verticies
257 generate_points -40 0 0 $colorG_R $colorG_G $colorG_B
258 eval vdrawparray tfan03 trianglefans $vbo_enable ( b 4 ( $pts02 $pts01 $pts03 $pts04 )), ( b 4 ( $pts03 $pts05 $pts06 $pts04 ))
260 # ****************************** Graphic3d_ArrayOfTriangleStrips ****************************** #
261 puts "Graphic3d_ArrayOfTriangleStrips: TEST"
265 generate_points -50 0 0 $colorB_R $colorB_G $colorB_B
266 eval vdrawparray tstrip01 trianglestrips $vbo_enable ( $pts06 $pts04 $pts03 $pts02 $pts01 )
267 eval vdrawparray tstrip02 trianglestrips $vbo_enable ( $pts03 $pts05 $pts06 )
269 # 2: bounds and verticies
271 generate_points -60 0 0 $colorG_R $colorG_G $colorG_B
272 eval vdrawparray tstrip03 trianglestrips $vbo_enable ( b 5 ( $pts06 $pts04 $pts03 $pts02 $pts01 )) , ( b 3 ( $pts03 $pts05 $pts06 ))
274 # ****************************** Graphic3d_ArrayOfQuadrangles ****************************** #
275 puts "Graphic3d_ArrayOfQuadrangles: TEST"
279 generate_points -70 0 0 $colorB_R $colorB_G $colorB_B
280 eval vdrawparray q01 quads $vbo_enable ( $pts01 $pts03 $pts04 $pts02 )
281 eval vdrawparray q02 quads $vbo_enable ( $pts03 $pts05 $pts06 $pts04 )
283 # 2: verticies and edges
285 generate_points -80 0 0 $colorG_R $colorG_G $colorG_B
286 eval vdrawparray q03 quads $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 1 e 3 e 4 e 2 e 3 e 5 e 6 e 4
288 # ****************************** Graphic3d_ArrayOfQuadrangleStrips ****************************** #
289 puts "Graphic3d_ArrayOfQuadrangleStrips: TEST"
293 generate_points -90 0 0 $colorB_R $colorB_G $colorB_B
294 eval vdrawparray qstrips01 quadstrips $vbo_enable ( $pts02 $pts01 $pts04 $pts03 $pts06 $pts05 )
296 # 2: verticies and edges
298 generate_points -100 0 0 $colorG_R $colorG_G $colorG_B
299 eval vdrawparray qstrips02 quadstrips $vbo_enable ( b 4 ( $pts02 $pts01 $pts04 $pts03 )) , ( b 4 ( $pts04 $pts03 $pts06 $pts05 ))
301 # ****************************** Graphic3d_ArrayOfPolygons ****************************** #
302 puts "Graphic3d_ArrayOfPolygons: TEST"
306 generate_points -110 0 0 $colorB_R $colorB_G $colorB_B
307 eval vdrawparray poly01 polygons $vbo_enable ( $pts04 $pts02 $pts01 $pts03 $pts05 $pts06 )
309 # 2: verticies and bounds
311 generate_points -120 0 0 $colorG_R $colorG_G $colorG_B
312 eval vdrawparray poly02 polygons $vbo_enable ( b 5 ( $pts04 $pts02 $pts01 $pts03 $pts06 )) , ( b 3 ( $pts06 $pts03 $pts05 ))
314 # 3: verticies and edges
316 generate_points -130 0 0 $colorB_R $colorB_G $colorB_B
317 eval vdrawparray poly03 polygons $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 4 e 2 e 1 e 3 e 5 e 6
319 # 4: vertices, bounds and edges
321 generate_points -140 0 0 $colorG_R $colorG_G $colorG_B
322 eval vdrawparray poly04 polygons $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 ( b 5 ( e 4 e 2 e 1 e 3 e 6 )), ( b 3 ( e 6 e 3 e 5 ))
327 # dump resulted image
328 if { $vbo_enable == 0 } { vfeedback; vdump ${imagedir}/$ImageName1 }
329 if { $vbo_enable == 1 } { vfeedback; vdump ${imagedir}/$ImageName2 }
333 # delete internal procedures
334 rename generate_points ""
335 rename check_primitive ""
337 checkcolor 200 200 $colorG_R $colorG_G $colorG_B
338 checkcolor 220 200 $colorB_R $colorB_G $colorB_B
340 puts "BUG OK ${BUGNUMBER}"
342 puts "BUG FAULTY ${BUGNUMBER}"