12381341 |
1 | puts "========" |
2 | puts "Per-pixel lighting using GLSL program (Phong shading)" |
3 | puts "========" |
4 | |
5 | # import model |
6 | restore [locate_data_file occ/fuse.brep] f |
7 | tclean f |
8 | |
9 | # draw box |
12381341 |
10 | vclear |
8e0a2b19 |
11 | vclose ALL |
12 | vinit View1 |
4c513386 |
13 | vdefaults -absDefl 0.5 |
12381341 |
14 | vsetdispmode 1 |
15 | vaxo |
16 | vdisplay f |
17 | vfit |
18 | vrotate -0.5 0.0 0.0 |
19 | vfit |
20 | |
21 | # setup lights |
22 | vlight delete 0 |
23 | vlight delete 0 |
24 | vlight delete 0 |
25 | vlight delete 0 |
26 | vlight delete 0 |
27 | vlight add ambient color WHITE |
28 | vlight add directional dir 1 0 0 color GREEN headlight 1 |
29 | vlight add directional dir -1 0 0 color RED1 headlight 1 |
30 | |
31 | # take snapshot with fixed pipeline |
32 | vdump $::imagedir/${::casename}_OFF.png |
33 | vshaderprog f phong |
34 | vdump $::imagedir/${::casename}_ph1.png |
35 | |
36 | vclear |
37 | vdisplay f |
38 | vshaderprog f phong |
39 | vdump $::imagedir/${::casename}_ph2.png |
40 | vmoveto 250 250 |