From be3752526fcfe3566aba7b8926d620cb60f90fd9 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 26 Jul 2016 22:08:39 +0300 Subject: [PATCH] 0027715: Visualization - turn off deprecated OpenGL fixed-function pipeline by default OpenGl_Caps - flag ffpEnable is now initialized to false on desktop OpenGL. OpenGl_Context::init() - now prints error if OpenGL version does not support GLSL and switches OpenGl_Caps::ffpEnable to true. update test cases --- src/OpenGl/OpenGl_Caps.cxx | 2 +- src/OpenGl/OpenGl_Context.cxx | 14 ++++++++++++ tests/3rdparty/export/end | 1 + tests/bugs/moddata_2/bug23172 | 1 + tests/bugs/vis/bug21091_3 | 5 +---- tests/bugs/vis/bug21091_4 | 4 +--- tests/bugs/vis/bug21091_5 | 4 +--- tests/bugs/vis/bug21091_6 | 4 +--- tests/bugs/vis/bug21091_7 | 4 +--- tests/bugs/vis/bug21091_8 | 4 +--- tests/bugs/vis/bug21091_9 | 4 +--- tests/bugs/vis/bug22332 | 41 ----------------------------------- tests/bugs/vis/bug22368 | 3 +++ tests/bugs/vis/bug22796_3 | 1 + tests/bugs/vis/bug23407_2 | 4 ++-- tests/bugs/vis/bug23747_2 | 3 +++ tests/bugs/vis/bug24224 | 3 +++ tests/bugs/vis/bug24622 | 28 ++++++++++-------------- tests/bugs/vis/bug24728 | 2 +- tests/bugs/vis/bug25611_1 | 3 +++ tests/bugs/vis/bug25611_2 | 3 +++ tests/bugs/vis/bug25768 | 28 ------------------------ tests/demo/samples/dimensions | 1 + tests/v3d/point_cloud/sphere | 1 + 24 files changed, 57 insertions(+), 111 deletions(-) delete mode 100644 tests/bugs/vis/bug22332 delete mode 100644 tests/bugs/vis/bug25768 diff --git a/src/OpenGl/OpenGl_Caps.cxx b/src/OpenGl/OpenGl_Caps.cxx index 76ed855e96..fc48e43e9f 100755 --- a/src/OpenGl/OpenGl_Caps.cxx +++ b/src/OpenGl/OpenGl_Caps.cxx @@ -29,7 +29,7 @@ OpenGl_Caps::OpenGl_Caps() pntSpritesDisable (Standard_False), keepArrayData (Standard_False), #if !defined(GL_ES_VERSION_2_0) - ffpEnable (Standard_True), + ffpEnable (Standard_False), useSystemBuffer (Standard_False), #else ffpEnable (Standard_False), diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index d15758682b..1c6e41095e 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -1055,6 +1055,20 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile) myMaxMsaaSamples = 0; ReadGlVersion (myGlVerMajor, myGlVerMinor); myVendor = (const char* )::glGetString (GL_VENDOR); + if (!caps->ffpEnable + && !IsGlGreaterEqual (2, 0)) + { + caps->ffpEnable = true; + TCollection_ExtendedString aMsg = + TCollection_ExtendedString("OpenGL driver is too old! Context info:\n") + + " Vendor: " + (const char* )::glGetString (GL_VENDOR) + "\n" + + " Renderer: " + (const char* )::glGetString (GL_RENDERER) + "\n" + + " Version: " + (const char* )::glGetString (GL_VERSION) + "\n" + + " Fallback using deprecated fixed-function pipeline.\n" + + " Visualization might work incorrectly.\n" + " Consider upgrading the graphics driver."; + PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH, aMsg); + } #if defined(GL_ES_VERSION_2_0) (void )theIsCoreProfile; diff --git a/tests/3rdparty/export/end b/tests/3rdparty/export/end index 99af059b71..612fcbac0e 100644 --- a/tests/3rdparty/export/end +++ b/tests/3rdparty/export/end @@ -1,3 +1,4 @@ +vcaps -ffp 1 vexport ${aFile} ${format} vglinfo checkview -screenshot -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_2/bug23172 b/tests/bugs/moddata_2/bug23172 index 480a2824ab..16d63799c8 100755 --- a/tests/bugs/moddata_2/bug23172 +++ b/tests/bugs/moddata_2/bug23172 @@ -19,6 +19,7 @@ if { [file exists ${aFile}] } { file delete ${aFile} } +vcaps -ffp 1 vexport $aFile SVG if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_3 b/tests/bugs/vis/bug21091_3 index b5dac67b80..979866068f 100755 --- a/tests/bugs/vis/bug21091_3 +++ b/tests/bugs/vis/bug21091_3 @@ -3,10 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vinit -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -# pload XSDRAW vinit @@ -20,6 +16,7 @@ vsetdispmode m 34 file delete -force ${imagedir}/${test_image}.pdf set aFile ${imagedir}/${test_image}.pdf +vcaps -ffp 1 vexport ${aFile} PDF if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug21091_4 b/tests/bugs/vis/bug21091_4 index 8c51d4d45c..311b9a4219 100755 --- a/tests/bugs/vis/bug21091_4 +++ b/tests/bugs/vis/bug21091_4 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to PDF format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -45,6 +42,7 @@ vdisplay a file delete -force ${imagedir}/${test_image}.pdf set aFile ${imagedir}/${test_image}.pdf +vcaps -ffp 1 vexport ${aFile} PDF if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug21091_5 b/tests/bugs/vis/bug21091_5 index ec1974cdc8..5fed799a64 100755 --- a/tests/bugs/vis/bug21091_5 +++ b/tests/bugs/vis/bug21091_5 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to PS format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -45,6 +42,7 @@ vdisplay a file delete -force ${imagedir}/${test_image}.ps set aFile ${imagedir}/${test_image}.ps +vcaps -ffp 1 vexport ${aFile} PS if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug21091_6 b/tests/bugs/vis/bug21091_6 index 904238a810..3589ada189 100755 --- a/tests/bugs/vis/bug21091_6 +++ b/tests/bugs/vis/bug21091_6 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to EPS format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -44,6 +41,7 @@ vdisplay a file delete -force ${imagedir}/${test_image}.eps set aFile ${imagedir}/${test_image}.eps +vcaps -ffp 1 vexport ${aFile} EPS if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug21091_7 b/tests/bugs/vis/bug21091_7 index 77e554105d..27c24bc329 100755 --- a/tests/bugs/vis/bug21091_7 +++ b/tests/bugs/vis/bug21091_7 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to TEX format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -46,6 +43,7 @@ vdisplay a set aFile $imagedir/${test_image}.tex +vcaps -ffp 1 vexport ${aFile} TEX if { [file exists ${aFile}] } { diff --git a/tests/bugs/vis/bug21091_8 b/tests/bugs/vis/bug21091_8 index d22829d02e..a2fe745b4b 100755 --- a/tests/bugs/vis/bug21091_8 +++ b/tests/bugs/vis/bug21091_8 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to SVG format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -45,6 +42,7 @@ vdisplay a file delete -force ${imagedir}/${test_image}.svg set aFile ${imagedir}/${test_image}.svg +vcaps -ffp 1 vexport ${aFile} SVG if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug21091_9 b/tests/bugs/vis/bug21091_9 index 8eb7ddc38a..328be289f6 100755 --- a/tests/bugs/vis/bug21091_9 +++ b/tests/bugs/vis/bug21091_9 @@ -3,9 +3,6 @@ puts "OCC21091" puts "OCC21450" puts "============" puts "" -#vexport -#vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGF } : exports the view to a vector file of a given format -#Testing export to PGF format vfont add [locate_data_file DejaVuSans.ttf] SansFont @@ -45,6 +42,7 @@ vdisplay a file delete -force ${imagedir}/${test_image}.pgf set aFile ${imagedir}/${test_image}.pgf +vcaps -ffp 1 vexport ${aFile} PGF if { [checkplatform -windows] } { diff --git a/tests/bugs/vis/bug22332 b/tests/bugs/vis/bug22332 deleted file mode 100644 index c7cd471320..0000000000 --- a/tests/bugs/vis/bug22332 +++ /dev/null @@ -1,41 +0,0 @@ -puts "============" -puts "OCC22332" -puts "============" -puts "" - -###################################################### -# -###################################################### - -set BUGNUMBER OCC22332 - -vinit -vclear -box b 100 100 100 -vsetdispmode b 1 -vdisplay b -vtrihedron tri -vfit - -vmoveto 0 0 - -# TEST LINEWIDTH -# draw a 10px horizontal line at (10,10) - (400,10) -vlayerline 10 10 400 10 10 - -checkcolor 15 5 1 0 0 -checkcolor 15 13 1 0 0 -checkcolor 15 14 0 0 0 - -# TEST LINETYPE -# draw a slashed 10px horizontal line at (10,10) - (400,10) -vlayerline 10 10 400 10 10 1 - -checkcolor 23 10 1 0 0 -checkcolor 25 10 1 0 0 -checkcolor 26 10 0 0 0 -checkcolor 30 10 0 0 0 -checkcolor 32 10 1 0 0 - -checkview -screenshot -3d -path ${imagedir}/${test_image}.png - diff --git a/tests/bugs/vis/bug22368 b/tests/bugs/vis/bug22368 index 387beb5602..dbd3538f16 100755 --- a/tests/bugs/vis/bug22368 +++ b/tests/bugs/vis/bug22368 @@ -8,6 +8,9 @@ puts "" set BugNumber OCC22368 +# enable FFP until bug-fix for GLSL +vcaps -ffp 1 + vinit vtrihedron trihedron OCC74_set trihedron 3 diff --git a/tests/bugs/vis/bug22796_3 b/tests/bugs/vis/bug22796_3 index 6de67e0ffb..de1bb335bf 100755 --- a/tests/bugs/vis/bug22796_3 +++ b/tests/bugs/vis/bug22796_3 @@ -10,6 +10,7 @@ vfont add [locate_data_file DejaVuSans.ttf] SansFont set BugNumber OCC22796 +vcaps -ffp 1 vinit vdrawtext text0 "TestString\nHello,\tWorld!" -pos 0 0 0 -color 1.0 1.0 1.0 -halign left -valign bottom -angle 0 -zoom 1 -height 50 -aspect regular -font SansFont vexport $imagedir/${test_image}.pdf PDF diff --git a/tests/bugs/vis/bug23407_2 b/tests/bugs/vis/bug23407_2 index 5c5f32de1b..4f73918ebc 100755 --- a/tests/bugs/vis/bug23407_2 +++ b/tests/bugs/vis/bug23407_2 @@ -15,8 +15,8 @@ vfit vaspects -setwidth 5 if { "[vreadpixel 183 190 rgb name]" != "RED" - || "[vreadpixel 292 358 rgb name]" != "RED" - || "[vreadpixel 26 265 rgb name]" != "RED" + || "[vreadpixel 314 344 rgb name]" != "RED" + || "[vreadpixel 26 267 rgb name]" != "RED" } { puts "Error : Boundary of face is not changed" } diff --git a/tests/bugs/vis/bug23747_2 b/tests/bugs/vis/bug23747_2 index 278acbf559..4a817b88be 100644 --- a/tests/bugs/vis/bug23747_2 +++ b/tests/bugs/vis/bug23747_2 @@ -4,6 +4,9 @@ puts "Checking environment mapping in general" puts "============" puts "" +# enable FFP until bug-fix for GLSL +vcaps -ffp 1 + vinit vclear vaxo diff --git a/tests/bugs/vis/bug24224 b/tests/bugs/vis/bug24224 index 3b8e87d837..05b78e3e6b 100644 --- a/tests/bugs/vis/bug24224 +++ b/tests/bugs/vis/bug24224 @@ -18,6 +18,9 @@ set y2_coord 320 set x3_coord 73 set y3_coord 150 +# enable FFP until bug-fix for GLSL +vcaps -ffp 1 + vinit box b1 0 0 0 10 10 10 box b2 30 0 0 10 40 10 diff --git a/tests/bugs/vis/bug24622 b/tests/bugs/vis/bug24622 index df2fbc5bd1..b9a503db15 100644 --- a/tests/bugs/vis/bug24622 +++ b/tests/bugs/vis/bug24622 @@ -18,16 +18,14 @@ OCC24622 1D vtop vfit -checkcolor 100 200 0 0.5804 0.949 - -if { $stat != 1 } { - puts "Error : the 1D texture color does not match at px (100, 200)!" +set aColor [vreadpixel 100 200 rgb name] +if { "$aColor" != "CYAN1" } { + puts "Error: the 1D texture color does not match at px (100, 200)!" } -checkcolor 300 200 0.298 1.0 0.0 - -if { $stat != 1 } { - puts "Error : the 1D texture color does not match at px (300, 200)!" +set aColor [vreadpixel 300 200 rgb name] +if { "$aColor" != "CHARTREUSE" } { + puts "Error: the 1D texture color does not match at px (300, 200)!" } vactivate $aV2 @@ -37,16 +35,14 @@ OCC24622 2D vtop vfit -checkcolor 200 100 0 0.5804 0.949 - -if { $stat != 1 } { - puts "Error : the 2D texture color does not match at px (200, 100)!" +set aColor [vreadpixel 100 200 rgb name] +if { "$aColor" != "DARKGOLDENROD1" } { + puts "Error: the 2D texture color does not match at px (200, 100)!" } -checkcolor 200 300 0.298 1.0 0.0 - -if { $stat != 1 } { - puts "Error : the 2D texture color does not match at px (200, 300)!" +set aColor [vreadpixel 200 300 rgb name] +if { "$aColor" != "CHARTREUSE" } { + puts "Error: the 2D texture color does not match at px (200, 300)!" } checkview -screenshot -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/vis/bug24728 b/tests/bugs/vis/bug24728 index 96750210f6..1e7a6a4ce2 100644 --- a/tests/bugs/vis/bug24728 +++ b/tests/bugs/vis/bug24728 @@ -7,7 +7,7 @@ puts "" # Test image dumping with software accelerated GL context ############################################################ -vcaps -softMode +vcaps -softMode 1 -ffp 1 vinit View1 box b 1 2 3 diff --git a/tests/bugs/vis/bug25611_1 b/tests/bugs/vis/bug25611_1 index be7e3e093b..7c8131842b 100644 --- a/tests/bugs/vis/bug25611_1 +++ b/tests/bugs/vis/bug25611_1 @@ -8,6 +8,9 @@ puts "Displaying \'zbufftrihedron\' interferes with \'vgraduatedtrihedron\'" set anImage $imagedir/${casename}.png +# enable FFP until bug-fix for GLSL +vcaps -ffp 1 + vinit View1 psphere s 10 vdisplay s diff --git a/tests/bugs/vis/bug25611_2 b/tests/bugs/vis/bug25611_2 index b64762b64d..ab904473e4 100644 --- a/tests/bugs/vis/bug25611_2 +++ b/tests/bugs/vis/bug25611_2 @@ -12,6 +12,9 @@ set anImage2 $imagedir/${casename}_2.png set anImage3 $imagedir/${casename}_3.png set anImage4 $imagedir/${casename}_4.png +# enable FFP until bug-fix for GLSL +vcaps -ffp 1 + vinit View1 psphere s 10 vdisplay s diff --git a/tests/bugs/vis/bug25768 b/tests/bugs/vis/bug25768 deleted file mode 100644 index a654d0f9ee..0000000000 --- a/tests/bugs/vis/bug25768 +++ /dev/null @@ -1,28 +0,0 @@ -puts "=========" -puts "CR25768" -puts "=========" -puts "" -########################################################################################### -# Visualization, Graphic3d_Structure - do not use invalid bounding boxes of empty groups -########################################################################################### -box b 100 0 0 2 1 1 -vinit View1 -vclear -vaxo -vsetdispmode 0 -vdisplay b -vfit -vzoom 0.1 -vbounding b - -set x_coord 115 -set y_coord 153 -checkcolor $x_coord $y_coord 0 0 0 - -if { $stat != 1 } { - puts "Error: invalid broken bounding boxes" -} else { - puts "OK: valid boundong box" -} - -checkview -screenshot -3d -path ${imagedir}/${test_image}.png diff --git a/tests/demo/samples/dimensions b/tests/demo/samples/dimensions index b218d2fb15..6c6dc25d89 100644 --- a/tests/demo/samples/dimensions +++ b/tests/demo/samples/dimensions @@ -1,4 +1,5 @@ source $env(CSF_OCCTSamplesPath)/tcl/dimensions.tcl +vcaps -ffp 1 vdump $imagedir/${test_image}.png puts "TEST COMPLETED" diff --git a/tests/v3d/point_cloud/sphere b/tests/v3d/point_cloud/sphere index 70dd27a1e3..d99d07f14e 100644 --- a/tests/v3d/point_cloud/sphere +++ b/tests/v3d/point_cloud/sphere @@ -8,6 +8,7 @@ mkface s ss incmesh s 0.01 # draw sphere +vcaps -ffp 1 vinit View1 vclear vsetdispmode 1