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