0024348: TKOpenGl - the same GLSL program can not be re-assigned
[occt.git] / tests / v3d / glsl / phong_sides
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
10 vinit View1
11 vclear
12 vsetdispmode 1
13 vaxo
14 vdisplay b_1 b_2
15 vfit
16 vrotate 0.2 0.0 0.0
17
18 # take snapshot with fixed pipeline
19 vdump $::imagedir/${::casename}_OFF.png
20 set aColorB [vreadpixel 150 150 rgb name]
21 set aColorF [vreadpixel 250 250 rgb name]
22 if { "$aColorB" != "$aColorF"} {
23   puts "Error: front/back colors are different!"
24 }
25 set aColorFixed $aColorF
26
27 # activate phong shader
28 vshaderprog phong
29 set aColorB [vreadpixel 150 150 rgb name]
30 set aColorF [vreadpixel 250 250 rgb name]
31 if { "$aColorB" != "$aColorF"} {
32   puts "Error: front/back colors are different!"
33 }
34
35 if { "$aColorF" != "$aColorFixed"} {
36   puts "Error: colors are different!"
37 }