1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00
occt/tests/v3d/glsl/shading_models
kgv 08669adf1b 0031419: Visualization, TKOpenGl - per-object Graphic3d_TOSM_FACET is ignored within obsolete FFP
OpenGl_ShaderManager::PushState() now sets GL_SHADE_MODEL within FFP.
OpenGl_Context::SetShadeModel(), added property holding cached GL_SHADE_MODEL state.
2020-03-11 18:37:12 +03:00

56 lines
1.9 KiB
Plaintext

puts "========"
puts "Test various Shading Models assigned per-object"
puts "========"
# setup viewer
vclear
vclose ALL
vinit View1 -width 912 -height 912
# define spheres with a rough triangulation to easily distinguish Shading Models
psphere p1 10
copytranslate p2 p1 40 0 0
copytranslate p3 p1 20 20 0
copytranslate p4 p1 0 40 0
copytranslate p5 p1 40 40 0
compound p1 p2 p3 p4 p5 ss
incmesh ss 1
vdefaults -autoTriang 0
# display objects
vdisplay -dispMode 1 p1 p2 p3 p4 p5
vdrawparray p6 triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 75 0 v 0 55 20 v 0 55 0 v 0 55 20 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
vdrawparray p7 triangles v 40 55 0 v 40 75 0 v 60 55 0 v 40 55 0 v 40 75 0 v 40 55 20 v 40 55 0 v 40 55 20 v 60 55 0 v 40 75 0 v 40 55 20 v 60 55 0
vtop
vrotate -0.9 0.1 0
vfit
vcaps -ffp 1
vdump $::imagedir/${::casename}_defaults_ffp.png
vcaps -ffp 0
vdump $::imagedir/${::casename}_defaults.png
# customize shading models
vaspects p1 -setShadingModel VERTEX
vdrawtext t1 Graphic3d_TOSM_VERTEX -pos 10 5 10 -color RED -aspect BOLD
vaspects p2 -setShadingModel FRAGMENT
vdrawtext t2 Graphic3d_TOSM_FRAGMENT -pos 50 5 10 -color RED -aspect BOLD
vaspects p3 -setShadingModel DEFAULT
vdrawtext t3 Graphic3d_TOSM_DEFAULT -pos 30 25 10 -color RED -aspect BOLD
vaspects p4 -setShadingModel UNLIT
vdrawtext t4 Graphic3d_TOSM_UNLIT -pos 10 45 10 -color RED -aspect BOLD
vaspects p5 -setShadingModel FACET
vdrawtext t5 Graphic3d_TOSM_FACET -pos 50 45 10 -color RED -aspect BOLD
vaspects p6 -setShadingModel DEFAULT
vdrawtext t6 Graphic3d_TOSM_DEFAULT -pos 10 65 10 -color RED -aspect BOLD
vaspects p7 -setShadingModel FACET
vdrawtext t7 Graphic3d_TOSM_FACET -pos 50 65 10 -color RED -aspect BOLD
vdisplay -topmost t1 t2 t3 t4 t5 t6 t7
vcaps -ffp 1
vdump $::imagedir/${::casename}_ffp.png
vcaps -ffp 0
vdump $::imagedir/${::casename}.png