puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"

pload MODELING VISUALIZATION

# import model
restore [locate_data_file occ/fuse.brep] f
tclean f

# draw box
vclear
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1
vaxo
vdisplay f
vfit
vrotate -0.5 0.0 0.0
vfit

# setup lights
vlight -clear
vlight amblight  -type AMBIENT                 -color WHITE
vlight dirlight1 -type DIRECTIONAL -dir  1 0 0 -color GREEN -headlight 1
vlight dirlight2 -type DIRECTIONAL -dir -1 0 0 -color RED1  -headlight 1

# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
vshaderprog f phong
vdump $::imagedir/${::casename}_ph1.png

vclear
vdisplay f
vshaderprog f phong
vdump $::imagedir/${::casename}_ph2.png
vmoveto 250 250