puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading), check plastic material"
puts "========"

pload MODELING VISUALIZATION

# create box
box b 1 2 3

# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay     b
vsetmaterial b PLASTIC
vsetcolor    b GREEN
vfit
vrotate 0.2 0.0 0.0

# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
set aColorL [vreadpixel 150 250 rgb name]
set aColorR [vreadpixel 250 250 rgb name]
if { "$aColorL" != "GREEN3" || "$aColorR" != "GREEN4" } { puts "Error: wrong color (fixed pipeline)!" }

vshaderprog b phong
set aColorL [vreadpixel 150 250 rgb name]
set aColorR [vreadpixel 250 250 rgb name]
if { "$aColorL" != "GREEN3" || "$aColorR" != "GREEN4" } { puts "Error: wrong color (Phong shader)!" }
vdump ${imagedir}/${casename}.png