1puts "========"
2puts "Per-pixel lighting using GLSL program (Phong shading), check lighting of back faces"
3puts "========"
4
5pload MODELING VISUALIZATION
6
7# create box
8box b 1 2 3
9explode b F
10
11# draw box
12vclear
13vclose ALL
14vinit View1
15vsetdispmode 1
16vaxo
17vdisplay b_1 b_2
18vfit
19vrotate 0.2 0.0 0.0
20
21# take snapshot with fixed pipeline
22vdump $::imagedir/${::casename}_OFF.png
23set aColorB [vreadpixel 150 150 rgb name]
24set aColorF [vreadpixel 250 250 rgb name]
25if { "$aColorB" != "$aColorF"} { puts "Error: front/back colors are different!" }
26set aColorFixed $aColorF
27
28# activate phong shader
29vshaderprog phong
30set aColorB [vreadpixel 150 150 rgb name]
31set aColorF [vreadpixel 250 250 rgb name]
32if { "$aColorB" != "$aColorF"} { puts "Error: front/back colors are different!" }
33if { "$aColorF" != "$aColorFixed"} { puts "Error: colors are different!" }
34vdump ${imagedir}/${casename}.png
35