1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
puts "============"
puts "OCC23226"
puts "============"
puts ""
#######################################################################
# Extend OpenGl_Context to store map of shared GPU resources
#######################################################################
set BugNumber OCC23226
#
# This test is modified test cdl/934/C2
#
# this test performs automatical test of primitives array objects by pixel checking
# this test ALSO DUMPS two result images (the primitives on the images should have
# same contours, WIREFRAME OBJECTS ARE IN YELLOW-RED COLORS, SHADED OBJECTS ARE
# BLUE-GREEN COLORS)
set BUGNUMBER OCC22583
set status 0
set ImageName1 "occ22583-image1.png"
set ImageName2 "occ22583-image2.png"
# set window width and height, this values should correspond to a
# view window sizes to pass the test
set view_width 405
set view_height 405
# colors used for tests
# yellow
set colorY_R 1
set colorY_G 1
set colorY_B 0
# red
set colorR_R 1
set colorR_G 0
set colorR_B 0
# blue
set colorB_R 0
set colorB_G 1
set colorB_B 1
# green
set colorG_R 0
set colorG_G 1
set colorG_B 0
# limit of range where the pixels are tested (sets number of iterations)
# 30 pixels in width and in height will be enough to test all primitives
set limit_x 3
set limit_y 3
# this procedure is internal and will be removed at the end of the script
# generate points for primitive
proc generate_points {x y z r g b} {
# define top plane points
global pts01 pts02 pts03 pts04 pts05 pts06
set pts01 "v [expr "$x-5"] [expr "$y+5"] [expr "$z"] n 0 0 -1 c $r $g $b"
set pts02 "v [expr "$x "] [expr "$y+5"] [expr "$z"] n 0 0 -1 c $r $g $b"
set pts03 "v [expr "$x "] [expr "$y "] [expr "$z"] n 0 0 -1 c $r $g $b"
set pts04 "v [expr "$x+5"] [expr "$y "] [expr "$z"] n 0 0 -1 c $r $g $b"
set pts05 "v [expr "$x-5"] [expr "$y-5"] [expr "$z"] n 0 0 -1 c $r $g $b"
set pts06 "v [expr "$x "] [expr "$y-5"] [expr "$z"] n 0 0 -1 c $r $g $b"
}
# this procedure is internal and will be removed at the end of the script
# check pixels of primitive
proc check_primitive {name1 r g b args} {
global limit_x limit_y view_width view_height
# show only primitive that we interested in to test
vdonly $name1 $args
vtop
vfit
# move cursor not to select shape
vmoveto 0 0
vmoveto 0 0
# test pixels in a top left corner
set TestPassed 0
set HasPixel 0
for {set i 0} {$i < $limit_x} {incr i} {
for {set j 0} {$j < $limit_y} {incr j} {
if { "[vreadpixel $i $j rgb]" == "$r $g $b" } {
set HasPixel 1
}
}
}
if { $HasPixel == 1 } {
set TestPassed [expr $TestPassed + 1]
} else {
set TestPassed 0
}
# test pixels in bottom left corner
set HasPixel 1
for {set i 0} {$i < $limit_x} {incr i} {
for {set j 0} {$j < $limit_y} {incr j} {
set coord_y [expr $view_height-$j]
if { "[vreadpixel $i $coord_y rgb]" == "$r $g $b" } {
set HasPixel 1
}
}
}
if { $HasPixel == 1 } {
set TestPassed [expr $TestPassed + 1]
} else {
set TestPassed 0
}
# test pixels in center right corner
set HasPixel 1
for {set i 0} {$i < $limit_x} {incr i} {
for {set j 0} {$j < $limit_y} {incr j} {
set coord_x [expr ($view_width-$limit_y) + $i]
set coord_y [expr ($view_height-$limit_y)/2 + $j]
if { "[vreadpixel $coord_x $coord_y rgb]" == "$r $g $b" } {
set HasPixel 1
}
}
}
if { $HasPixel == 1 } {
set TestPassed [expr $TestPassed + 1]
} else {
set TestPassed 0
}
# test pixels in center left corner (shouldn't be anything)
set HasPixel 0
for {set i 0} {$i < $limit_x} {incr i} {
for {set j 0} {$j < $limit_y} {incr j} {
set coord_x [expr $view_width/4 + $i]
set coord_y [expr ($view_height-$limit_y)/2 + $j]
if { "[vreadpixel $coord_x $coord_y rgb]" == "$r $g $b" } {
set HasPixel 1
}
}
}
if { $HasPixel == 1 } {
set TestPassed 0
} else {
set TestPassed [expr $TestPassed + 1]
}
# show all primitives
vdisplayall
vtop
vfit
# return a result
if { ${TestPassed} == 4 } {
return 1
} else {
return 0
}
}
# ### THIS IS THE HEAD LOOP OF THE TEST ####################
# During this test primitives are created and displayed
# with commands vdrawparray, and verified for consistency
# with check_primitive procedure. In spite of the fact that there
# a lot of code below, it's similar and divided on the similar
# blocks of code.
# The iteration loop is intended to check primitives with
# "vertex buffer objects" turned off (vbo_enable = 0) and
# turned on (vbo_enable = 1)
for {set vbo_enable 0} {$vbo_enable < 2} {incr vbo_enable} {
vinit
if { $vbo_enable == 0 } {
vvbo 0
puts "TEST WITH VBO is OFF"
}
if { $vbo_enable == 1 } {
vvbo 1
puts "TEST WITH VBO is ON"
}
## vinit
veraseall
vclear
# this points are only to simplify visiual check of dumped image
vpoint point1 65 0 0
vpoint point2 -145 0 0
# ****************************** Graphic3d_ArrayOfPoints ****************************** #
puts "Graphic3d_ArrayOfPoints: TEST"
#
# 1: verticies
#
generate_points 60 0 0 $colorY_R $colorY_G $colorY_B
eval vdrawparray pt01 points $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06
# ****************************** Graphic3d_ArrayOfSegments ****************************** #
puts "Graphic3d_ArrayOfSegments: TEST"
#
# 1: verticies
#
generate_points 50 0 0 $colorY_R $colorY_G $colorY_B
eval vdrawparray seg01 segments $vbo_enable $pts02 $pts01 $pts01 $pts03 $pts03 $pts05 $pts05 $pts06 $pts06 $pts04 $pts04 $pts02
#
# 2: edges
#
generate_points 40 0 0 $colorR_R $colorR_G $colorR_B
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
# ****************************** Graphic3d_ArrayOfPolylines ****************************** #
puts "Graphic3d_ArrayOfPolylines: TEST"
#
# 1: verticies
#
generate_points 30 0 0 $colorY_R $colorY_G $colorY_B
eval vdrawparray pline01 polylines $vbo_enable $pts02 $pts01 $pts03 $pts05 $pts06 $pts04 $pts02
#
# 2: edges
#
generate_points 20 0 0 $colorR_R $colorR_G $colorR_B
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
#
# 3: bounds
#
generate_points 10 0 0 $colorY_R $colorY_G $colorY_B
eval vdrawparray pline03 polylines $vbo_enable ( b 3 ( $pts02 $pts01 $pts03 )), ( b 4 ( $pts03 $pts05 $pts06 $pts04 )), ( b 2 ( $pts04 $pts02 ))
#
# 4: verticies, bounds and edges
#
generate_points 0 0 0 $colorR_R $colorR_G $colorR_B
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 ))
# ****************************** Graphic3d_ArrayOfTriangles ****************************** #
puts "Graphic3d_ArrayOfTriangles: TEST"
#
# 1: verticies
#
generate_points -10 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray t01 triangles $vbo_enable ( $pts03 $pts02 $pts01 ) , ( $pts03 $pts04 $pts02 ) , ( $pts04 $pts03 $pts06 ) , ( $pts06 $pts03 $pts05 )
#
# 2: by edges
#
generate_points -20 0 0 $colorG_R $colorG_G $colorG_B
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
# ****************************** Graphic3d_ArrayOfTriangleFans ****************************** #
puts "Graphic3d_ArrayOfTriangleFans: TEST"
#
# 1: verticies
#
generate_points -30 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray tfan01 trianglefans $vbo_enable ( $pts02 $pts01 $pts03 $pts04 )
eval vdrawparray tfan02 trianglefans $vbo_enable ( $pts03 $pts05 $pts06 $pts04 )
#
# 2: bounds and verticies
#
generate_points -40 0 0 $colorG_R $colorG_G $colorG_B
eval vdrawparray tfan03 trianglefans $vbo_enable ( b 4 ( $pts02 $pts01 $pts03 $pts04 )), ( b 4 ( $pts03 $pts05 $pts06 $pts04 ))
# ****************************** Graphic3d_ArrayOfTriangleStrips ****************************** #
puts "Graphic3d_ArrayOfTriangleStrips: TEST"
#
# 1: verticies
#
generate_points -50 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray tstrip01 trianglestrips $vbo_enable ( $pts06 $pts04 $pts03 $pts02 $pts01 )
eval vdrawparray tstrip02 trianglestrips $vbo_enable ( $pts03 $pts05 $pts06 )
#
# 2: bounds and verticies
#
generate_points -60 0 0 $colorG_R $colorG_G $colorG_B
eval vdrawparray tstrip03 trianglestrips $vbo_enable ( b 5 ( $pts06 $pts04 $pts03 $pts02 $pts01 )) , ( b 3 ( $pts03 $pts05 $pts06 ))
# ****************************** Graphic3d_ArrayOfQuadrangles ****************************** #
puts "Graphic3d_ArrayOfQuadrangles: TEST"
#
# 1: verticies
#
generate_points -70 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray q01 quads $vbo_enable ( $pts01 $pts03 $pts04 $pts02 )
eval vdrawparray q02 quads $vbo_enable ( $pts03 $pts05 $pts06 $pts04 )
#
# 2: verticies and edges
#
generate_points -80 0 0 $colorG_R $colorG_G $colorG_B
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
# ****************************** Graphic3d_ArrayOfQuadrangleStrips ****************************** #
puts "Graphic3d_ArrayOfQuadrangleStrips: TEST"
#
# 1: verticies
#
generate_points -90 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray qstrips01 quadstrips $vbo_enable ( $pts02 $pts01 $pts04 $pts03 $pts06 $pts05 )
#
# 2: verticies and edges
#
generate_points -100 0 0 $colorG_R $colorG_G $colorG_B
eval vdrawparray qstrips02 quadstrips $vbo_enable ( b 4 ( $pts02 $pts01 $pts04 $pts03 )) , ( b 4 ( $pts04 $pts03 $pts06 $pts05 ))
# ****************************** Graphic3d_ArrayOfPolygons ****************************** #
puts "Graphic3d_ArrayOfPolygons: TEST"
#
# 1: verticies
#
generate_points -110 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray poly01 polygons $vbo_enable ( $pts04 $pts02 $pts01 $pts03 $pts05 $pts06 )
#
# 2: verticies and bounds
#
generate_points -120 0 0 $colorG_R $colorG_G $colorG_B
eval vdrawparray poly02 polygons $vbo_enable ( b 5 ( $pts04 $pts02 $pts01 $pts03 $pts06 )) , ( b 3 ( $pts06 $pts03 $pts05 ))
#
# 3: verticies and edges
#
generate_points -130 0 0 $colorB_R $colorB_G $colorB_B
eval vdrawparray poly03 polygons $vbo_enable $pts01 $pts02 $pts03 $pts04 $pts05 $pts06 e 4 e 2 e 1 e 3 e 5 e 6
#
# 4: vertices, bounds and edges
#
generate_points -140 0 0 $colorG_R $colorG_G $colorG_B
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 ))
vtop
vfit
# dump resulted image
if { $vbo_enable == 0 } { vfeedback; vdump ${imagedir}/$ImageName1 }
if { $vbo_enable == 1 } { vfeedback; vdump ${imagedir}/$ImageName2 }
}
# delete internal procedures
rename generate_points ""
rename check_primitive ""
checkcolor 200 200 $colorG_R $colorG_G $colorG_B
checkcolor 220 200 $colorB_R $colorB_G $colorB_B
if { $stat == 1 } {
puts "BUG OK ${BUGNUMBER}"
} else {
puts "BUG FAULTY ${BUGNUMBER}"
}
set only_screen 1
|