]> OCCT Git - occt-copy.git/commitdiff
0027811: Configuration - allow building TKOpenGl with OpenGL ES on Windows
authorkgv <kgv@opencascade.com>
Wed, 31 Aug 2016 16:34:32 +0000 (19:34 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 8 Sep 2016 07:46:58 +0000 (10:46 +0300)
OpenGl_ShaderManager::prepareStdProgramFboBlit() now tries using extension
GL_EXT_frag_depth within OpenGL ES 2.0 when OpenGL ES 3.0 is not available.
OpenGl_View::blitBuffers() now disables Depth test
when copying depth values is not supported by OpenGL ES 2.0 hardware.

Fixed building for UWP with SDK 10.0.10240.0
Fixed building TKService, TKV3d and TKOpenGl for UWP.

OSD_Environment now defines global environment map
for emulating desktop behavior on UWP.

37 files changed:
CMakeLists.txt
adm/cmake/egl.cmake [new file with mode: 0644]
adm/cmake/gles2.cmake [new file with mode: 0644]
adm/cmake/occt_csf.cmake
adm/cmake/tcl.cmake
adm/cmake/tk.cmake
adm/cmake/vardescr.cmake
adm/genconf.tcl
adm/genconfdeps.tcl
adm/genproj.tcl
adm/templates/OpenCASCADEConfig.cmake.in
adm/templates/custom.build.bat.in
adm/templates/custom.install.bat.in
adm/templates/env.bat
adm/templates/env.bat.in
adm/templates/env.sh
src/Aspect/Aspect_NeutralWindow.cxx [new file with mode: 0644]
src/Aspect/Aspect_NeutralWindow.hxx [new file with mode: 0644]
src/Aspect/FILES
src/Font/Font_FontMgr.cxx
src/OSD/OSD_Environment.cxx
src/OSD/OSD_signal.cxx
src/OpenGl/OpenGl_AVIWriter.hxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_GraphicDriver.hxx
src/OpenGl/OpenGl_ShaderManager.cxx
src/OpenGl/OpenGl_View_Redraw.cxx
src/OpenGl/OpenGl_Window.cxx
src/Standard/Standard_Mutex.cxx
src/ViewerTest/ViewerTest_OpenGlCommands.cxx
src/WNT/WNT_WClass.cxx
src/WNT/WNT_WClass.hxx
src/WNT/WNT_Window.cxx
src/WNT/WNT_Window.hxx

index 356714015dfb3b3cc5c0f7914e1983eabf06cb39..ee5e9edc3fceb52fdc7fbb2aec98bed7558c7750 100644 (file)
@@ -501,6 +501,34 @@ else()
   OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
 endif()
 
+# OpenGL ES 2.0
+OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
+if (WIN32 AND CAN_USE_GLES2)
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
+    set (USE_GLES2 ON)
+  else()
+    set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
+  endif()
+
+  if (USE_GLES2)
+    add_definitions (-DHAVE_GLES2)
+    OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
+       OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
+  else()
+    OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
+    OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
+    OCCT_CHECK_AND_UNSET ("INSTALL_EGL")
+    OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
+  endif()
+else()
+  OCCT_CHECK_AND_UNSET ("USE_GLES2")
+
+  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
+  OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
+  OCCT_CHECK_AND_UNSET ("INSTALL_EGL")
+  OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
+endif()
+
 # GL2PS
 # search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit
 OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
diff --git a/adm/cmake/egl.cmake b/adm/cmake/egl.cmake
new file mode 100644 (file)
index 0000000..fcbcbc7
--- /dev/null
@@ -0,0 +1,6 @@
+# EGL
+if (WIN32)
+  THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "libEGL" "libEGL")
+else()
+  THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "EGL" "EGL")
+endif()
diff --git a/adm/cmake/gles2.cmake b/adm/cmake/gles2.cmake
new file mode 100644 (file)
index 0000000..d834b66
--- /dev/null
@@ -0,0 +1,6 @@
+# OpenGL ES 2.0
+if (WIN32)
+  THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "libGLESv2" "libGLESv2")
+else()
+  THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "GLESv2" "GLESv2")
+endif()
index 100b57a34054b52c5fcf7a1351179b7954145a50..47071f8e86f483fd6c5d749f0df094cc27ebdd6a 100644 (file)
@@ -36,7 +36,11 @@ if (WIN32)
   set (CSF_winspool      "Winspool.lib")
   set (CSF_psapi         "Psapi.lib")
   set (CSF_AviLibs       "ws2_32.lib vfw32.lib")
-  set (CSF_OpenGlLibs    "opengl32.lib")
+  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
+    set (CSF_OpenGlLibs  "libEGL.lib libGLESv2.lib")
+  else()
+    set (CSF_OpenGlLibs  "opengl32.lib")
+  endif()
 
   if (USE_FREETYPE)
     set (CSF_FREETYPE "freetype.lib")
index 5e7686470b73d31b905114a0779855bd038bea7f..5bed15eec0588bdbb7ab8dfc96a12fd08b68ec86 100644 (file)
@@ -80,7 +80,7 @@ if (BUILD_SHARED_LIBS)
 
   if (WIN32)
     if (NOT 3RDPARTY_TCL_DLL)
-      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
 
       set (DLL_FOLDER_FOR_SEARCH "")
       if (3RDPARTY_TCL_DLL_DIR)
@@ -147,7 +147,7 @@ if (BUILD_SHARED_LIBS)
 
   if (WIN32)
     if (NOT 3RDPARTY_TCL_DLL)
-      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll)
+      set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll .a)
 
       set (DLL_FOLDER_FOR_SEARCH "")
       if (3RDPARTY_TCL_DLL_DIR)
index 5f58ae07bf0108557f31b0a434361841665305f9..09f2f23c274674307a769497b5eec576840a5cde 100644 (file)
@@ -84,7 +84,7 @@ if (BUILD_SHARED_LIBS)
 
   if (WIN32)
     if (NOT 3RDPARTY_TK_DLL)
-        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+        set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" ".a")
 
         set (DLL_FOLDER_FOR_SEARCH "")
         if (3RDPARTY_TK_DLL_DIR)
@@ -151,7 +151,7 @@ if (BUILD_SHARED_LIBS)
 
   if (WIN32)
     if (NOT 3RDPARTY_TK_DLL)
-      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+      set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" ".a")
 
       set (DLL_FOLDER_FOR_SEARCH "")
       if (3RDPARTY_TK_DLL_DIR)
index eb64e81a6986f9b49057afe0124f2db1d984e06d..875107073aa9dad623b35f51930105f90e456eb5 100644 (file)
@@ -72,6 +72,8 @@ INSTALL_MESSAGE (INSTALL_SAMPLES          "OCCT samples")
 INSTALL_MESSAGE (INSTALL_TEST_CASES       "non-regression OCCT test scripts")
 INSTALL_MESSAGE (INSTALL_DOC_Overview     "OCCT overview documentation (HTML format)")
 INSTALL_MESSAGE (INSTALL_FREEIMAGE        "FreeImage binaries")
+INSTALL_MESSAGE (INSTALL_EGL              "EGL binaries")
+INSTALL_MESSAGE (INSTALL_GLES2            "OpenGL ES 2.0 binaries")
 INSTALL_MESSAGE (INSTALL_FREETYPE         "FreeType binaries")
 INSTALL_MESSAGE (INSTALL_GL2PS            "GL2PS binaries")
 INSTALL_MESSAGE (INSTALL_TBB              "TBB binaries")
@@ -127,6 +129,14 @@ set (USE_FREEIMAGE_DESCR
 "Indicates whether Freeimage product should be used in OCCT visualization
 module for support of popular graphics image formats (PNG, BMP etc)")
 
+set (USE_EGL_DESCR
+"Indicates whether EGL should be used in OCCT visualization
+module instead of conventional OpenGL context creation APIs")
+
+set (USE_GLES2_DESCR
+"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization
+module instead of desktop OpenGL")
+
 set (USE_GL2PS_DESCR
 "Indicates whether GL2PS product should be used in OCCT visualization
 module for support of vector image formats (PS, EPS etc)")
@@ -148,7 +158,7 @@ set (USE_D3D_DESCR "Indicates whether optional Direct3D wrapper in OCCT visualiz
 
 macro (BUILD_MODULE MODULE_NAME)
   set (ENABLE_MODULE TRUE)
-  set (OCCT_MODULES_FOR_UWP FoundationClasses ModelingAlgorithms ModelingData)
+  set (OCCT_MODULES_FOR_UWP FoundationClasses ModelingAlgorithms ModelingData DataExchange Visualization)
   list (FIND OCCT_MODULES_FOR_UWP ${OCCT_MODULE} CAN_BE_USED_IN_UWP)
   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" AND CAN_BE_USED_IN_UWP EQUAL -1)
     set (ENABLE_MODULE FALSE)
index 6b22f1004bf424df9a74ae9393e09c26f90d8161..802ed4972b27d15434ec853e4704d99e88f37865 100644 (file)
@@ -127,6 +127,16 @@ proc wokdep:gui:UpdateList {} {
   wokdep:SearchTclTk     anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
   wokdep:SearchFreeType  anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
   wokdep:SearchX11       anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
+  if { "$::HAVE_GLES2" == "true" } {
+    if { "$::HAVE_GL2PS" == "true" } {
+      lappend anIncErrs "Error: gl2ps can not be used within OpenGL ES"
+    }
+    if { "$::HAVE_D3D" == "true" } {
+      lappend anIncErrs "Error: Direct3D can not be used within OpenGL ES"
+    }
+    wokdep:SearchEGL     anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
+    wokdep:SearchGLES    anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
+  }
   if { "$::HAVE_FREEIMAGE" == "true" } {
     wokdep:SearchFreeImage anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
   }
@@ -384,6 +394,10 @@ checkbutton   .myFrame.myChecks.myGl2psCheck    -offvalue "false" -onvalue "true
 ttk::label    .myFrame.myChecks.myGl2psLbl      -text "Use GL2PS"
 checkbutton   .myFrame.myChecks.myTbbCheck      -offvalue "false" -onvalue "true" -variable HAVE_TBB       -command wokdep:gui:UpdateList
 ttk::label    .myFrame.myChecks.myTbbLbl        -text "Use Intel TBB"
+if { "$::tcl_platform(os)" != "Darwin" } {
+  checkbutton .myFrame.myChecks.myGlesCheck     -offvalue "false" -onvalue "true" -variable HAVE_GLES2     -command wokdep:gui:UpdateList
+  ttk::label  .myFrame.myChecks.myGlesLbl       -text "Use OpenGL ES"
+}
 if { "$::tcl_platform(platform)" == "windows" } {
   checkbutton .myFrame.myChecks.myD3dCheck      -offvalue "false" -onvalue "true" -variable HAVE_D3D       -command wokdep:gui:UpdateList
   ttk::label  .myFrame.myChecks.myD3dLbl        -text "Use Direct3D"
@@ -487,10 +501,8 @@ grid .myFrame.myChecks.myTbbCheck      -row $aCheckRowIter -column 2 -sticky e
 grid .myFrame.myChecks.myTbbLbl        -row $aCheckRowIter -column 3 -sticky w
 grid .myFrame.myChecks.myQt4Check      -row $aCheckRowIter -column 4 -sticky e
 grid .myFrame.myChecks.myQt4Lbl        -row $aCheckRowIter -column 5 -sticky w
-if { "$::tcl_platform(platform)" == "windows" } {
-  grid .myFrame.myChecks.myD3dCheck    -row $aCheckRowIter -column 6 -sticky e
-  grid .myFrame.myChecks.myD3dLbl      -row $aCheckRowIter -column 7 -sticky w
-}
+grid .myFrame.myChecks.myGlesCheck     -row $aCheckRowIter -column 6 -sticky e
+grid .myFrame.myChecks.myGlesLbl       -row $aCheckRowIter -column 7 -sticky w
 #grid .myFrame.myChecks.myOpenClCheck   -row $aCheckRowIter -column 6 -sticky e
 #grid .myFrame.myChecks.myOpenClLbl     -row $aCheckRowIter -column 7 -sticky w
 incr aCheckRowIter
@@ -500,6 +512,10 @@ grid .myFrame.myChecks.myVtkCheck      -row $aCheckRowIter -column 2 -sticky e
 grid .myFrame.myChecks.myVtkLbl        -row $aCheckRowIter -column 3 -sticky w
 grid .myFrame.myChecks.myJDKCheck      -row $aCheckRowIter -column 4 -sticky e
 grid .myFrame.myChecks.myJDKLbl        -row $aCheckRowIter -column 5 -sticky w
+if { "$::tcl_platform(platform)" == "windows" } {
+  grid .myFrame.myChecks.myD3dCheck    -row $aCheckRowIter -column 6 -sticky e
+  grid .myFrame.myChecks.myD3dLbl      -row $aCheckRowIter -column 7 -sticky w
+}
 incr aCheckRowIter
 if { "$::tcl_platform(os)" == "Darwin" } {
   grid .myFrame.myChecks.myMacGLXCheck -row $aCheckRowIter -column 0 -sticky e
index 1fc7f841bebe8f89b5afed68a58381ef61c16df8..d6f40f89bd57d4eb1e12a8270aecfe168db89d48 100644 (file)
@@ -47,6 +47,7 @@ set HAVE_FREEIMAGE "false"
 set HAVE_GL2PS     "false"
 set HAVE_TBB       "false"
 set HAVE_D3D       "false"
+set HAVE_GLES2     "false"
 set HAVE_OPENCL    "false"
 set HAVE_VTK       "false"
 set MACOSX_USE_GLX "false"
@@ -89,6 +90,9 @@ if { [info exists ::env(HAVE_TBB)] } {
 if { [info exists ::env(HAVE_D3D)] } {
   set HAVE_D3D "$::env(HAVE_D3D)"
 }
+if { [info exists ::env(HAVE_GLES2)] } {
+  set HAVE_GLES2 "$::env(HAVE_GLES2)"
+}
 if { [info exists ::env(HAVE_OPENCL)] } {
   set HAVE_OPENCL "$::env(HAVE_OPENCL)"
 }
@@ -647,6 +651,148 @@ proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBi
   return "$isFound"
 }
 
+# Search EGL library placement
+proc wokdep:SearchEGL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
+  upvar $theErrInc   anErrInc
+  upvar $theErrLib32 anErrLib32
+  upvar $theErrLib64 anErrLib64
+  upvar $theErrBin32 anErrBin32
+  upvar $theErrBin64 anErrBin64
+
+  set isFound "true"
+  set aHeaderPath [wokdep:SearchHeader "EGL/egl.h"]
+  if { "$aHeaderPath"  == "" } {
+    set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$::ARCH" ]
+    if { "$aPath" == "" || ![file exists "$aPath/include/EGL/egl.h"] } {
+      set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
+    }
+
+    if { "$aPath" != "" && [file exists "$aPath/include/EGL/egl.h"] } {
+      lappend ::CSF_OPT_INC "$aPath/include"
+    } else {
+      lappend anErrInc "Error: 'EGL/egl.h' not found (EGL)"
+      set isFound "false"
+    }
+  }
+
+  set aLibName "EGL"
+  if { "$::tcl_platform(platform)" == "windows" } {
+    # awkward exception
+    set aLibName "libEGL"
+  }
+
+  foreach anArchIter {64 32} {
+    set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
+    if { "$aLibPath" == "" } {
+      set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
+      set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
+      if { "$aLibPath" == "" } {
+        set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
+        set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
+      }
+
+      if { "$aLibPath" != "" } {
+        lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
+      } else {
+        lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (EGL)"
+        if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
+      }
+    }
+
+    if { "$::tcl_platform(platform)" == "windows" } {
+      set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter"]
+      if { "$aDllPath" == "" } {
+        set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
+        set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
+        if { "$aDllPath" == "" } {
+          set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
+          set aDllPath [wokdep:SearchBin "libEGL.dll" "$anArchIter" "$aPath/bin"]
+        }
+
+        if { "$aDllPath" != "" } {
+          lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
+        } else {
+          lappend anErrBin$anArchIter "Error: 'libEGL.dll' not found (EGL)"
+          if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
+        }
+      }
+    }
+  }
+
+  return "$isFound"
+}
+
+# Search OpenGL ES 2.0 library placement
+proc wokdep:SearchGLES {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
+  upvar $theErrInc   anErrInc
+  upvar $theErrLib32 anErrLib32
+  upvar $theErrLib64 anErrLib64
+  upvar $theErrBin32 anErrBin32
+  upvar $theErrBin64 anErrBin64
+
+  set isFound "true"
+  set aHeaderPath [wokdep:SearchHeader "GLES2/gl2.h"]
+  if { "$aHeaderPath"  == "" } {
+    set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$::ARCH" ]
+    if { "$aPath" == "" || ![file exists "$aPath/include/GLES2/gl2.h"] } {
+      set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$::ARCH" ]
+    }
+
+    if { "$aPath" != "" && [file exists "$aPath/include/GLES2/gl2.h"] } {
+      lappend ::CSF_OPT_INC "$aPath/include"
+    } else {
+      lappend anErrInc "Error: 'GLES2/gl2.h' not found (OpenGL ES 2.0)"
+      set isFound "false"
+    }
+  }
+
+  set aLibName "GLESv2"
+  if { "$::tcl_platform(platform)" == "windows" } {
+    # awkward exception
+    set aLibName "libGLESv2"
+  }
+
+  foreach anArchIter {64 32} {
+    set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter"]
+    if { "$aLibPath" == "" } {
+      set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{GLES}*] "$::VCVER" "$anArchIter" ]
+      set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
+      if { "$aLibPath" == "" } {
+        set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
+        set aLibPath [wokdep:SearchLib "$aLibName" "$anArchIter" "$aPath/lib"]
+      }
+
+      if { "$aLibPath" != "" } {
+        lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
+      } else {
+        lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aLibName}.${::SYS_LIB_SUFFIX}' not found (OpenGL ES 2.0)"
+        if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
+      }
+    }
+
+    if { "$::tcl_platform(platform)" == "windows" } {
+      set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter"]
+      if { "$aDllPath" == "" } {
+        set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{EGL}*] "$::VCVER" "$anArchIter" ]
+        set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
+        if { "$aDllPath" == "" } {
+          set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{angle}*] "$::VCVER" "$anArchIter" ]
+          set aDllPath [wokdep:SearchBin "libGLESv2.dll" "$anArchIter" "$aPath/bin"]
+        }
+
+        if { "$aDllPath" != "" } {
+          lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
+        } else {
+          lappend anErrBin$anArchIter "Error: 'libGLESv2.dll' not found (OpenGL ES 2.0)"
+          if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
+        }
+      }
+    }
+  }
+
+  return "$isFound"
+}
+
 # Auxiliary function, gets VTK version to set default search directory
 proc wokdep:VtkVersion { thePath } {
   set aResult "6.1"
@@ -932,6 +1078,7 @@ proc wokdep:SaveCustom {} {
     puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
     puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
     puts $aFile "set HAVE_TBB=$::HAVE_TBB"
+    puts $aFile "set HAVE_GLES2=$::HAVE_GLES2"
     puts $aFile "set HAVE_D3D=$::HAVE_D3D"
     puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
     puts $aFile "set HAVE_VTK=$::HAVE_VTK"
@@ -982,6 +1129,7 @@ proc wokdep:SaveCustom {} {
     puts $aFile "export HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
     puts $aFile "export HAVE_GL2PS=$::HAVE_GL2PS"
     puts $aFile "export HAVE_TBB=$::HAVE_TBB"
+    puts $aFile "export HAVE_GLES2=$::HAVE_GLES2"
     puts $aFile "export HAVE_OPENCL=$::HAVE_OPENCL"
     puts $aFile "export HAVE_VTK=$::HAVE_VTK"
     if { "$::tcl_platform(os)" == "Darwin" } {
index c8645131b736146259df3cbc5fa76264f5238b49..237f05a36772e322e2a02a3960dfc258c0cd949a 100644 (file)
@@ -1106,6 +1106,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
     set aLibsMap(CSF_netapi32)     "netapi32"
     set aLibsMap(CSF_AviLibs)      "ws2_32 vfw32"
     set aLibsMap(CSF_OpenGlLibs)   "opengl32"
+    if { "$::HAVE_GLES2" == "true" } {
+      set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
+    }
     set aLibsMap(CSF_winspool)     "Winspool"
     set aLibsMap(CSF_psapi)        "Psapi"
     set aLibsMap(CSF_d3d9)         "d3d9"
@@ -1139,6 +1142,10 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
         set aLibsMap(CSF_XwLibs)     "X11 Xext Xmu Xi"
         set aLibsMap(CSF_MotifLibs)  "X11"
       }
+
+      if { "$::HAVE_GLES2" == "true" } {
+        set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
+      }
     }
   }
 }
index 46ce0ab5104f18310dc4f1c08bd71eccad7bf534..ca45c3f1cf82cd36066fd2320d6612c02a6f459d 100644 (file)
@@ -61,6 +61,7 @@ set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
 set (OpenCASCADE_WITH_GL2PS     @USE_GL2PS@)
 set (OpenCASCADE_WITH_TBB       @USE_TBB@)
 set (OpenCASCADE_WITH_VTK       @USE_VTK@)
+set (OpenCASCADE_WITH_GLES2     @USE_GLES2@)
 @SET_OpenCASCADE_WITH_D3D@
 @SET_OpenCASCADE_WITH_GLX@
 
index e27d66bc990d3e7e244715bd3bbbe50fa8cf8436..7682b07697b34396eac5f3146e76516d89f3b55b 100644 (file)
@@ -6,6 +6,8 @@ if /I "%VCVER%" == "@COMPILER@" (
     set "TK_DIR=@3RDPARTY_TK_DLL_DIR@"
     set "FREETYPE_DIR=@3RDPARTY_FREETYPE_DLL_DIR@"
     set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@"
+    set "EGL_DIR=@3RDPARTY_EGL_DLL_DIR@"
+    set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIR@"
     set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@"
     set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
     set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
index e3cd47c1110b932bf3b55f14fc8051466986ebf9..4fb05ac4204702fe260fd38c18a463227d8818b8 100644 (file)
@@ -8,6 +8,8 @@ if /I "%VCVER%" == "@COMPILER@" (
     set "TK_DIR=@USED_3RDPARTY_TK_DIR@"
     set "FREETYPE_DIR=@USED_3RDPARTY_FREETYPE_DIR@"
     set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIR@"
+    set "EGL_DIR=@USED_3RDPARTY_EGL_DIR@"
+    set "GLES2_DIR=@USED_3RDPARTY_GLES2_DIR@"
     set "GL2PS_DIR=@USED_3RDPARTY_GL2PS_DIR@"
     set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
     set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
index 17852495ccde84073be1ed2de07b319d77bde16e..5ac65bcfe3d95aec6f9fd34a363134061e2f5eb6 100644 (file)
@@ -20,6 +20,7 @@ set "HAVE_OPENCL=false"
 set "HAVE_FREEIMAGE=false"
 set "HAVE_GL2PS=false"
 set "HAVE_VTK=false"
+set "HAVE_GLES2=false"
 set "HAVE_D3D=false"
 set "CSF_OPT_INC="
 set "CSF_OPT_LIB32="
@@ -62,12 +63,14 @@ if ["%HAVE_OPENCL%"]    == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
 if ["%HAVE_GL2PS%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS"
 if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE"
 if ["%HAVE_VTK%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK"
+if ["%HAVE_GLES2%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2"
 if ["%HAVE_D3D%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D"
 if ["%HAVE_TBB%"]       == ["true"] set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
 if ["%HAVE_OPENCL%"]    == ["true"] set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
 if ["%HAVE_GL2PS%"]     == ["true"] set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
 if ["%HAVE_FREEIMAGE%"] == ["true"] set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
 if ["%HAVE_VTK%"]       == ["true"] set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
+if ["%HAVE_GLES2%"]     == ["true"] set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
 if ["%HAVE_D3D%"]       == ["true"] set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
 
 rem Eliminate VS warning
index 27e15b1c9babd54c92857c1aa604effc1cd4d87e..0820cdb8a073759258d37ec742799a84c42cd39a 100644 (file)
@@ -29,6 +29,8 @@ if not ["%TCL_DIR%"] == [""]           set "PATH=%TCL_DIR%;%PATH%"
 if not ["%TK_DIR%"] == [""]            set "PATH=%TK_DIR%;%PATH%"
 if not ["%FREETYPE_DIR%"] == [""]      set "PATH=%FREETYPE_DIR%;%PATH%"
 if not ["%FREEIMAGE_DIR%"] == [""]     set "PATH=%FREEIMAGE_DIR%;%PATH%"
+if not ["%EGL_DIR%"] == [""]           set "PATH=%EGL_DIR%;%PATH%"
+if not ["%GLES2_DIR%"] == [""]         set "PATH=%GLES2_DIR%;%PATH%"
 if not ["%GL2PS_DIR%"] == [""]         set "PATH=%GL2PS_DIR%;%PATH%"
 if not ["%TBB_DIR%"] == [""]           set "PATH=%TBB_DIR%;%PATH%"
 if not ["%VTK_DIR%"] == [""]           set "PATH=%VTK_DIR%;%PATH%"
index 751610e2281ae877d38005e41857caaef2c65507..94e395c0482c2dfe70edffc91c5ae156d6fa141f 100644 (file)
@@ -12,6 +12,7 @@ export HAVE_OPENCL="false";
 export HAVE_FREEIMAGE="false";
 export HAVE_GL2PS="false";
 export HAVE_VTK="false";
+export HAVE_GLES2="false";
 export MACOSX_USE_GLX="false";
 export CSF_OPT_INC=""
 export CSF_OPT_LIB32=""
@@ -102,6 +103,9 @@ fi
 if [ "$HAVE_GL2PS" == "true" ]; then
   export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GL2PS"
 fi
+if [ "$HAVE_GLES2" == "true" ]; then
+  export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"
+fi
 if [ "$HAVE_VTK" == "true" ]; then
   export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"
 fi
diff --git a/src/Aspect/Aspect_NeutralWindow.cxx b/src/Aspect/Aspect_NeutralWindow.cxx
new file mode 100644 (file)
index 0000000..d53d7b1
--- /dev/null
@@ -0,0 +1,111 @@
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Aspect_NeutralWindow.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Aspect_NeutralWindow, Aspect_Window)
+
+// =======================================================================
+// function : Aspect_NeutralWindow
+// purpose  :
+// =======================================================================
+Aspect_NeutralWindow::Aspect_NeutralWindow()
+: myHandle (0),
+  myParentHandle (0),
+  myFBConfig (0),
+  myPosX (0),
+  myPosY (0),
+  myWidth (0),
+  myHeight (0),
+  myIsMapped (Standard_True) {}
+
+// =======================================================================
+// function : SetNativeHandles
+// purpose  :
+// =======================================================================
+Standard_Boolean Aspect_NeutralWindow::SetNativeHandles (Aspect_Drawable theWindow,
+                                                         Aspect_Drawable theParentWindow,
+                                                         Aspect_FBConfig theFbConfig)
+{
+  if (myHandle       == theWindow
+   && myParentHandle == theParentWindow
+   && myFBConfig     == theFbConfig)
+  {
+    return Standard_False;
+  }
+
+  myHandle       = theWindow;
+  myParentHandle = theParentWindow;
+  myFBConfig     = theFbConfig;
+  return Standard_True;
+}
+
+// =======================================================================
+// function : SetPosition
+// purpose  :
+// =======================================================================
+Standard_Boolean Aspect_NeutralWindow::SetPosition (Standard_Integer theX1,
+                                                    Standard_Integer theY1)
+{
+  if (myPosX == theX1
+   && myPosY == theY1)
+  {
+    return Standard_False;
+  }
+
+  myPosX = theX1;
+  myPosY = theY1;
+  return Standard_True;
+}
+
+// =======================================================================
+// function : SetPosition
+// purpose  :
+// =======================================================================
+Standard_Boolean Aspect_NeutralWindow::SetPosition (Standard_Integer theX1, Standard_Integer theY1,
+                                                    Standard_Integer theX2, Standard_Integer theY2)
+{
+  Standard_Integer aWidthNew  = theX2 - theX1;
+  Standard_Integer aHeightNew = theY2 - theY1;
+  if (myPosX == theX1
+   && myPosY == theY1
+   && myWidth  == aWidthNew
+   && myHeight == aHeightNew)
+  {
+    return Standard_False;
+  }
+
+  myPosX   = theX1;
+  myWidth  = aWidthNew;
+  myPosY   = theY1;
+  myHeight = aHeightNew;
+  return Standard_True;
+}
+
+// =======================================================================
+// function : SetSize
+// purpose  :
+// =======================================================================
+Standard_Boolean Aspect_NeutralWindow::SetSize (const Standard_Integer theWidth,
+                                                const Standard_Integer theHeight)
+{
+  if (myWidth  == theWidth
+   && myHeight == theHeight)
+  {
+    return Standard_False;
+  }
+
+  myWidth  = theWidth;
+  myHeight = theHeight;
+  return Standard_True;
+}
diff --git a/src/Aspect/Aspect_NeutralWindow.hxx b/src/Aspect/Aspect_NeutralWindow.hxx
new file mode 100644 (file)
index 0000000..cab0f96
--- /dev/null
@@ -0,0 +1,123 @@
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Aspect_NeutralWindow_HeaderFile
+#define _Aspect_NeutralWindow_HeaderFile
+
+#include <Aspect_Window.hxx>
+
+//! Defines a platform-neutral window.
+//! This class is intended to be used in context when window management (including OpenGL context creation)
+//! is performed on application side (e.g. using external framework).
+//!
+//! Window properties should be managed by application and assigned to this class as properties.
+class Aspect_NeutralWindow : public Aspect_Window
+{
+  DEFINE_STANDARD_RTTIEXT(Aspect_NeutralWindow, Aspect_Window)
+public:
+
+  //! Empty constructor.
+  //! Note that window is considered "mapped" by default.
+  Standard_EXPORT Aspect_NeutralWindow();
+
+  //! Return native handle of this drawable.
+  virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE { return myHandle; }
+
+  //! Return native handle of the parent drawable.
+  virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return myParentHandle; }
+
+  //! Return FBConfig.
+  virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return myFBConfig; }
+
+  //! Set native handle.
+  //! @return true if definition has been changed
+  Standard_EXPORT Standard_Boolean SetNativeHandle (Aspect_Drawable theWindow) { return SetNativeHandles (theWindow, 0, 0); }
+
+  //! Set native handles.
+  //! @return true if definition has been changed
+  Standard_EXPORT Standard_Boolean SetNativeHandles (Aspect_Drawable theWindow,
+                                                     Aspect_Drawable theParentWindow,
+                                                     Aspect_FBConfig theFbConfig);
+
+  //! Return true if window is not hidden.
+  virtual Standard_Boolean IsMapped() const Standard_OVERRIDE { return myIsMapped; }
+
+  //! Change window mapped flag to TRUE.
+  virtual void Map()   const Standard_OVERRIDE { myIsMapped = Standard_True; }
+
+  //! Change window mapped flag to FALSE.
+  virtual void Unmap() const Standard_OVERRIDE { myIsMapped = Standard_False; }
+
+  //! Resize window - do nothing.
+  virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; }
+
+  //! Map window - do nothing.
+  virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
+
+  //! Returns window ratio equal to the physical width/height dimensions.
+  virtual Quantity_Ratio Ratio() const Standard_OVERRIDE
+  {
+    return (myWidth != 0 && myHeight != 0)
+         ? Quantity_Ratio(myWidth) / Quantity_Ratio(myHeight)
+         : 1.0;
+  }
+
+  //! Return the window position.
+  virtual void Position (Standard_Integer& theX1, Standard_Integer& theY1,
+                         Standard_Integer& theX2, Standard_Integer& theY2) const Standard_OVERRIDE
+  {
+    theX1 = myPosX;
+    theX2 = myPosX + myWidth;
+    theY1 = myPosY;
+    theY2 = myPosY + myHeight;
+  }
+
+  //! Set the window position.
+  //! @return true if position has been changed
+  Standard_EXPORT Standard_Boolean SetPosition (Standard_Integer theX1,
+                                                Standard_Integer theY1);
+
+  //! Set the window position.
+  //! @return true if position has been changed
+  Standard_EXPORT Standard_Boolean SetPosition (Standard_Integer theX1, Standard_Integer theY1,
+                                                Standard_Integer theX2, Standard_Integer theY2);
+
+  //! Return the window size.
+  virtual void Size (Standard_Integer& theWidth,
+                     Standard_Integer& theHeight) const Standard_OVERRIDE
+  {
+    theWidth  = myWidth;
+    theHeight = myHeight;
+  }
+
+  //! Set the window size.
+  //! @return true if size has been changed
+  Standard_EXPORT Standard_Boolean SetSize (const Standard_Integer theWidth,
+                                            const Standard_Integer theHeight);
+
+protected:
+
+  Aspect_Drawable  myHandle;
+  Aspect_Drawable  myParentHandle;
+  Aspect_FBConfig  myFBConfig;
+  Standard_Integer myPosX;
+  Standard_Integer myPosY;
+  Standard_Integer myWidth;
+  Standard_Integer myHeight;
+  mutable Standard_Boolean myIsMapped;
+
+};
+
+DEFINE_STANDARD_HANDLE(Aspect_NeutralWindow, Aspect_Window)
+
+#endif // _Aspect_NeutralWindow_HeaderFile
index 4920a1bc527b9151447f2f8cd0dc74a3a16ecfd7..9f42897043196f83e47fcbbb4d2429145533643a 100755 (executable)
@@ -25,6 +25,8 @@ Aspect_Grid.cxx
 Aspect_Grid.hxx
 Aspect_GridDrawMode.hxx
 Aspect_GridType.hxx
+Aspect_NeutralWindow.cxx
+Aspect_NeutralWindow.hxx
 Aspect_Handle.hxx
 Aspect_HatchStyle.hxx
 Aspect_IdentDefinitionError.hxx
index de8e3c674504b2f4d0136c1a7a56d51791001c53..6c62f602251ea6154ecd9762bc7a9d91f84be857 100644 (file)
@@ -316,7 +316,10 @@ void Font_FontMgr::InitFontDataBase()
   myListOfFonts.Clear();
   Handle(Font_FTLibrary) aFtLibrary;
 
-#if defined(_WIN32)
+#if defined(OCCT_UWP)
+  // system font files are not accessible
+  (void )aFtLibrary;
+#elif defined(_WIN32)
 
   // font directory is placed in "C:\Windows\Fonts\"
   UINT aStrLength = GetSystemWindowsDirectoryA (NULL, 0);
index d3ed551773fc6b5433ab46d575a18f4d060cfc67..8a4e4e9eb53f79f6eb12941437499e2f13d7a7db 100644 (file)
@@ -240,13 +240,22 @@ Standard_Integer OSD_Environment::Error() const
 
 #include <windows.h>
 
+#include <NCollection_DataMap.hxx>
 #include <NCollection_UtfString.hxx>
+#include <Standard_Mutex.hxx>
 
 #if defined(_MSC_VER)
   #pragma warning( disable : 4700 )
 #endif
 
-#ifndef OCCT_UWP
+#ifdef OCCT_UWP
+namespace
+{
+  // emulate global map of environment variables
+  static Standard_Mutex THE_ENV_LOCK;
+  static NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> THE_ENV_MAP;
+}
+#else
 static void __fastcall _set_error ( OSD_Error&, DWORD );
 #endif
 
@@ -278,9 +287,11 @@ void OSD_Environment :: SetValue ( const TCollection_AsciiString& Value ) {
 
 TCollection_AsciiString OSD_Environment::Value()
 {
-#ifndef OCCT_UWP
   myValue.Clear();
-
+#ifdef OCCT_UWP
+  Standard_Mutex::Sentry aLock (THE_ENV_LOCK);
+  THE_ENV_MAP.Find (myName, myValue);
+#else
   SetLastError (ERROR_SUCCESS);
   wchar_t* anEnvVal = NULL;
   NCollection_UtfWideString aNameWide (myName.ToCString());
@@ -308,11 +319,8 @@ TCollection_AsciiString OSD_Environment::Value()
     Reset();
   }
   myValue = aValue.ToCString();
-  return myValue;
-#else
-  myValue = "";
-  return myValue;
 #endif
+  return myValue;
 }
 
 void OSD_Environment :: SetName ( const TCollection_AsciiString& name ) {
@@ -329,7 +337,10 @@ TCollection_AsciiString OSD_Environment :: Name () const {
 
 void OSD_Environment::Build()
 {
-#ifndef OCCT_UWP
+#ifdef OCCT_UWP
+  Standard_Mutex::Sentry aLock(THE_ENV_LOCK);
+  THE_ENV_MAP.Bind (myName, myValue);
+#else
   NCollection_Utf8String aSetVariable = NCollection_Utf8String(myName.ToCString()) + "=" + myValue.ToCString();
   _wputenv (aSetVariable.ToUtfWide().ToCString());
 #endif
@@ -337,7 +348,10 @@ void OSD_Environment::Build()
 
 void OSD_Environment::Remove()
 {
-#ifndef OCCT_UWP
+#ifdef OCCT_UWP
+  Standard_Mutex::Sentry aLock(THE_ENV_LOCK);
+  THE_ENV_MAP.UnBind (myName);
+#else
   NCollection_Utf8String aSetVariable = NCollection_Utf8String(myName.ToCString()) + "=";
   _wputenv (aSetVariable.ToUtfWide().ToCString());
 #endif
index 99968bf844cc6de4ddd75d359f315f24b5dc58a1..6f0451a3436f6a927af4a12460de4649d494e6bb 100644 (file)
@@ -363,6 +363,7 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
 {
 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
   Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
+#if !defined(OCCT_UWP) || defined(NTDDI_WIN10_TH2)
   LPTOP_LEVEL_EXCEPTION_FILTER aPreviousFilter;
 
   OSD_Environment env ("CSF_DEBUG_MODE");
@@ -382,6 +383,7 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
   // Replaces the existing top-level exception filter for all existing and all future threads
   // in the calling process
   aPreviousFilter = ::SetUnhandledExceptionFilter (/*(LPTOP_LEVEL_EXCEPTION_FILTER)*/ WntHandler);
+#endif // NTDDI_WIN10_TH2
 
   // Signal handlers will only be used when the method ::raise() will be used
   // Handlers must be set for every thread
index 9d80aa8f4588ea3ff2c189936c9b3e820e0690a6..96ad331978ac33ac5a8849d9d714174c9ef9c7f4 100644 (file)
 #ifndef __OPENGL_AVIWRITER_H
 #define __OPENGL_AVIWRITER_H
 
-#ifdef _MSC_VER
+#if defined(_WIN32)
+  #include <windows.h>
+#endif
+
+#include <Standard_Macro.hxx>
 
-#define THIS void
-#include <windows.h>
+#if defined(_MSC_VER) && !defined(OCCT_UWP)
 
 #include <stdlib.h>
 #include <vfw.h>
index 848282c5d1f52372b146c1dac89ec08d23de04cc..cf724a84f2194f9388373bf7ca75bc118c28d4a8 100644 (file)
@@ -134,6 +134,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
   arbDbg (NULL),
   arbFBO (NULL),
   arbFBOBlit (NULL),
+  extFragDepth (Standard_False),
   extGS  (NULL),
   extBgra(Standard_False),
   extAnis(Standard_False),
@@ -1200,6 +1201,8 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
   {
     arbFBOBlit = (OpenGl_ArbFBOBlit* )(&(*myFuncs));
   }
+  extFragDepth = !IsGlGreaterEqual(3, 0)
+               && CheckExtension ("GL_EXT_frag_depth");
   if (IsGlGreaterEqual (3, 1)
    && FindProc ("glTexStorage2DMultisample", myFuncs->glTexStorage2DMultisample))
   {
index dd7a83a30dbd3e2bee7499b44a9ceba89dd7f8b4..8bb04444c760d1167c3749286cb0400d61a10d81 100644 (file)
@@ -721,6 +721,7 @@ public: //! @name extensions
   OpenGl_ArbDbg*         arbDbg;         //!< GL_ARB_debug_output
   OpenGl_ArbFBO*         arbFBO;         //!< GL_ARB_framebuffer_object
   OpenGl_ArbFBOBlit*     arbFBOBlit;     //!< glBlitFramebuffer function, moved out from OpenGl_ArbFBO structure for compatibility with OpenGL ES 2.0
+  Standard_Boolean       extFragDepth;   //!< GL_EXT_frag_depth on OpenGL ES 2.0 (gl_FragDepthEXT built-in variable, before OpenGL ES 3.0)
   OpenGl_ExtGS*          extGS;          //!< GL_EXT_geometry_shader4
   Standard_Boolean       extBgra;        //!< GL_EXT_bgra or GL_EXT_texture_format_BGRA8888 on OpenGL ES
   Standard_Boolean       extAnis;        //!< GL_EXT_texture_filter_anisotropic
index 34da9ac7e2e5e80873c69261dfb94f07dc80bf2e..ff09ebb4aa8254c71abb1f8dd2c9261f9613eb13 100644 (file)
@@ -22,6 +22,9 @@
   #include <windows.h>
 #endif
 
+#include <Standard_Macro.hxx>
+#include <Standard_TypeDef.hxx>
+
 #ifndef APIENTRY
   #define APIENTRY
 #endif
     #include <OpenGL/gl.h>
   #endif
   #define __X_GL_H // prevent chaotic gl.h inclusions to avoid compile errors
-#elif defined(HAVE_GLES2) || defined(__ANDROID__) || defined(__QNX__)
+#elif defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
+  #if defined(_WIN32)
+    // Angle OpenGL ES headers do not define function prototypes even for core functions,
+    // however OCCT is expected to be linked against libGLESv2
+    #define GL_GLEXT_PROTOTYPES
+  #endif
   #include <GLES2/gl2.h>
   //#include <GLES3/gl3.h>
 #else
   #define GL_DEBUG_SEVERITY_LOW         0x9148
 #endif
 
-#if defined(__ANDROID__) || defined(__QNX__)
+#if !defined(HAVE_EGL) && (defined(__ANDROID__) || defined(__QNX__) || defined(HAVE_GLES2) || defined(OCCT_UWP))
   #define HAVE_EGL
 #endif
 
index 83cf40da17abc709c8615d7b9daa4c94e3bdc162..3664947be57bb53da49552c61a9564cd147ecf1b 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#if defined(_WIN32)
+  #include <windows.h>
+#endif
+
 #include <OpenGl_GraphicDriver.hxx>
 #include <OpenGl_Context.hxx>
 #include <OpenGl_Flipper.hxx>
@@ -44,7 +48,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
   #include <X11/Xlib.h> // XOpenDisplay()
 #endif
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   #include <EGL/egl.h>
 #endif
 
@@ -61,7 +65,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
                                             const Standard_Boolean                  theToInitialize)
 : Graphic3d_GraphicDriver (theDisp),
   myIsOwnContext (Standard_False),
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   myEglDisplay ((Aspect_Display )EGL_NO_DISPLAY),
   myEglContext ((Aspect_RenderingContext )EGL_NO_CONTEXT),
   myEglConfig  (NULL),
@@ -82,7 +86,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
              || ::getenv ("CALL_SYNCHRO_X")  != NULL;
   XSynchronize (aDisplay, toSync);
 
-#if !defined(HAVE_EGL)
+#if !defined(HAVE_EGL) && !defined(HAVE_GLES2)
   // does the server know about OpenGL & GLX?
   int aDummy;
   if (!XQueryExtension (aDisplay, "GLX", &aDummy, &aDummy, &aDummy))
@@ -206,7 +210,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
     aWindow->GetGlContext()->forcedRelease();
   }
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   if (myIsOwnContext)
   {
     if (myEglContext != (Aspect_RenderingContext )EGL_NO_CONTEXT)
@@ -241,7 +245,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
 Standard_Boolean OpenGl_GraphicDriver::InitContext()
 {
   ReleaseContext();
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
 
 #if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNX__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
   if (myDisplayConnection.IsNull())
@@ -322,17 +326,18 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
     ::Message::DefaultMessenger()->Send ("Error: EGL is unable to create OpenGL context!", Message_Fail);
     return Standard_False;
   }
-  if (eglMakeCurrent ((EGLDisplay )myEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, (EGLContext )myEglContext) != EGL_TRUE)
-  {
-    ::Message::DefaultMessenger()->Send ("Error: EGL is unable bind OpenGL context!", Message_Fail);
-    return Standard_False;
-  }
+  // eglMakeCurrent() fails or even crash with EGL_NO_SURFACE on some implementations
+  //if (eglMakeCurrent ((EGLDisplay )myEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, (EGLContext )myEglContext) != EGL_TRUE)
+  //{
+  //  ::Message::DefaultMessenger()->Send ("Error: EGL is unable bind OpenGL context!", Message_Fail);
+  //  return Standard_False;
+  //}
 #endif
   myIsOwnContext = Standard_True;
   return Standard_True;
 }
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
 // =======================================================================
 // function : InitEglContext
 // purpose  :
@@ -778,7 +783,7 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
   // Parse the list of views to find
   // a view with the specified window
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(OCCT_UWP)
   const Handle(WNT_Window) THEWindow = Handle(WNT_Window)::DownCast (AWindow);
   Aspect_Handle TheSpecifiedWindowId = THEWindow->HWindow ();
 #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
@@ -788,7 +793,7 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
   #else
     NSView* TheSpecifiedWindowId = THEWindow->HView();
   #endif
-#elif defined(__ANDROID__) || defined(__QNX__)
+#elif defined(__ANDROID__) || defined(__QNX__) || defined(OCCT_UWP)
   (void )AWindow;
   int TheSpecifiedWindowId = -1;
 #else
@@ -804,7 +809,7 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
     {
       const Handle(Aspect_Window) AspectWindow = aView->Window();
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(OCCT_UWP)
       const Handle(WNT_Window) theWindow = Handle(WNT_Window)::DownCast (AspectWindow);
       Aspect_Handle TheWindowIdOfView = theWindow->HWindow ();
 #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
@@ -814,7 +819,7 @@ Standard_Boolean OpenGl_GraphicDriver::ViewExists (const Handle(Aspect_Window)&
       #else
         NSView* TheWindowIdOfView = theWindow->HView();
       #endif
-#elif defined(__ANDROID__) || defined(__QNX__)
+#elif defined(__ANDROID__) || defined(__QNX__) || defined(OCCT_UWP)
       int TheWindowIdOfView = 0;
 #else
       const Handle(Xw_Window) theWindow = Handle(Xw_Window)::DownCast (AspectWindow);
index 29a40b9c3a609dd5cda1409288691615a3ff7057..fe14f3a4e09d566124b6e3cb9e93912ad9948bde 100644 (file)
@@ -100,7 +100,7 @@ public:
   //! Perform initialization of default OpenGL context.
   Standard_EXPORT Standard_Boolean InitContext();
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   //! Initialize default OpenGL context using existing one.
   //! @param theEglDisplay EGL connection to the Display
   //! @param theEglContext EGL rendering context
@@ -193,7 +193,7 @@ public:
   //! Could return NULL-handle if no window created by this driver.
   Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext() const;
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   Aspect_Display          getRawGlDisplay() const { return myEglDisplay; }
   Aspect_RenderingContext getRawGlContext() const { return myEglContext;  }
   void*                   getRawGlConfig()  const { return myEglConfig; }
@@ -209,7 +209,7 @@ public:
 protected:
 
   Standard_Boolean        myIsOwnContext; //!< indicates that shared context has been created within OpenGl_GraphicDriver
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__)
   Aspect_Display          myEglDisplay;   //!< EGL connection to the Display : EGLDisplay
   Aspect_RenderingContext myEglContext;   //!< EGL rendering context         : EGLContext
   void*                   myEglConfig;    //!< EGL configuration             : EGLConfig
index 735adc9f6c27569c3087956b30dc92f6dcd9b1b1..270c5e96b4d29897bef804b9186df8f46199b62e 100644 (file)
@@ -913,6 +913,11 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramFboBlit()
   {
     aProgramSrc->SetHeader ("#version 300 es");
   }
+  else if (myContext->extFragDepth)
+  {
+    aProgramSrc->SetHeader ("#extension GL_EXT_frag_depth : enable"
+                         EOL"#define gl_FragDepth gl_FragDepthEXT");
+  }
   else
   {
     // there is no way to draw into depth buffer
index 55d11d6dbb2c6cb0ca39b052a40b1456dbb69d7f..5985b030fd2867a0d94441fd67ff0ae9dd24a8a6 100644 (file)
@@ -1388,6 +1388,13 @@ bool OpenGl_View::blitBuffers (OpenGl_FrameBuffer*    theReadFbo,
     aCtx->core20fwd->glDepthFunc (GL_ALWAYS);
     aCtx->core20fwd->glDepthMask (GL_TRUE);
     aCtx->core20fwd->glEnable (GL_DEPTH_TEST);
+  #if defined(GL_ES_VERSION_2_0)
+    if (!aCtx->IsGlGreaterEqual (3, 0)
+     && !aCtx->extFragDepth)
+    {
+      aCtx->core20fwd->glDisable (GL_DEPTH_TEST);
+    }
+  #endif
 
     myWorkspace->DisableTexture();
 
index 1c442e49b6eb4242587f93d8ad4dda248c0b026e..2a0d43072fb0184687750d6734b111556539ef5d 100644 (file)
@@ -27,7 +27,7 @@
 
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared)
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL)
   #include <EGL/egl.h>
 #endif
 
@@ -37,7 +37,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared)
 namespace
 {
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL)
   //
 #elif defined(_WIN32)
 
@@ -173,7 +173,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_GraphicDriver)& theDriver,
 
   Standard_Boolean isCoreProfile = Standard_False;
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL)
   EGLDisplay anEglDisplay = (EGLDisplay )theDriver->getRawGlDisplay();
   EGLContext anEglContext = (EGLContext )theDriver->getRawGlContext();
   EGLConfig  anEglConfig  = (EGLConfig  )theDriver->getRawGlConfig();
@@ -616,7 +616,7 @@ OpenGl_Window::~OpenGl_Window()
   // release "GL" context if it is owned by window
   // Mesa implementation can fail to destroy GL context if it set for current thread.
   // It should be safer to unset thread GL context before its destruction.
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL)
   if ((EGLSurface )myGlContext->myWindow != EGL_NO_SURFACE)
   {
     eglDestroySurface ((EGLDisplay )myGlContext->myDisplay,
@@ -678,7 +678,7 @@ Standard_Boolean OpenGl_Window::Activate()
 // =======================================================================
 void OpenGl_Window::Resize()
 {
-#if !defined(_WIN32) && !defined(HAVE_EGL) && !defined(__ANDROID__) && !defined(__QNX__)
+#if !defined(_WIN32) && !defined(HAVE_EGL)
   Display* aDisp = (Display* )myGlContext->myDisplay;
   if (aDisp == NULL)
     return;
@@ -695,7 +695,7 @@ void OpenGl_Window::Resize()
   myWidth  = aWidth;
   myHeight = aHeight;
 
-#if !defined(_WIN32) && !defined(HAVE_EGL) && !defined(__ANDROID__) && !defined(__QNX__)
+#if !defined(_WIN32) && !defined(HAVE_EGL)
   XResizeWindow (aDisp, myGlContext->myWindow, (unsigned int )myWidth, (unsigned int )myHeight);
   XSync (aDisp, False);
 #endif
@@ -712,7 +712,7 @@ void OpenGl_Window::Init()
   if (!Activate())
     return;
 
-#if defined(HAVE_EGL) || defined(__ANDROID__) || defined(__QNX__)
+#if defined(HAVE_EGL)
   eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_WIDTH,  &myWidth);
   eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_HEIGHT, &myHeight);
 #elif defined(_WIN32)
index ee10a87631c9192db9b12fec98fc5dc069b257f9..0de020f54049cfc9fe77d21c320f210d7ff2ba88 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-// On Windows, function TryEnterCriticalSection has appeared in Windows NT
-// and is surrounded by #ifdef in MS VC++ 7.1 headers.
-// Thus to use it we need to define appropriate macro saying that we wil
-// run on Windows NT 4.0 at least
-#if ((defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN32_WINNT))
-  #define _WIN32_WINNT 0x0400
-#endif
-
 #include <Standard_Mutex.hxx>
 #include <Standard_OStream.hxx>
 
index 13cea1470a40d24082f5bae6d19e1629e06fec5a..d520f9959e8caa12fd3603e8125028b88ce8f589 100644 (file)
@@ -165,6 +165,7 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
   aTA->Aspect()->Font();
   OpenGl_Vec4 aColor = theWorkspace->LineColor();
 
+#if !defined(GL_ES_VERSION_2_0)
   // Finally draw something to make sure UserDraw really works
   glPushAttrib(GL_ENABLE_BIT);
   glDisable(GL_LIGHTING);
@@ -176,6 +177,7 @@ void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
   glVertex3f(myCoords[0], myCoords[1], myCoords[5]);
   glEnd();
   glPopAttrib();
+#endif
 }
 
 } // end of anonymous namespace
@@ -222,6 +224,7 @@ static int VFeedback (Draw_Interpretor& theDI,
                       Standard_Integer  /*theArgNb*/,
                       const char**      /*theArgVec*/)
 {
+#if !defined(GL_ES_VERSION_2_0)
   // get the active view
   Handle(V3d_View) aView = ViewerTest::CurrentView();
   if (aView.IsNull())
@@ -363,6 +366,11 @@ static int VFeedback (Draw_Interpretor& theDI,
           << "Buffer size GL_3D_COLOR: " << aLen3D_rgba * double(sizeof(GLfloat)) / double(1024 * 1024) << " MiB\n";
     return 0;
   }
+#else
+  (void )theDI;
+  std::cout << "Command is unsupported on current platform.\n";
+  return 1;
+#endif
 }
 
 //==============================================================================
index 51a153ebaddc01108bee9fc996cfe0623e47019e..e3f727172733539072e90bca73030e1be8332dd1 100644 (file)
 
 #include <windows.h>
 
+#include <WNT_WClass.hxx>
+
 #include <Standard_PCharacter.hxx>
 #include <Standard_Type.hxx>
 #include <WNT_ClassDefinitionError.hxx>
-#include <WNT_WClass.hxx>
 #include <WNT_Window.hxx>
 
+#if defined(_WIN32) && !defined(OCCT_UWP)
+
 #include <string.h>
 IMPLEMENT_STANDARD_RTTIEXT(WNT_WClass,MMgt_TShared)
 
@@ -78,3 +81,4 @@ WNT_WClass::~WNT_WClass ()
 
 }  // end WNT_WClass :: Destroy
 
+#endif // _WIN32
index 6b28ffe293abc495788cff92db0dbd14a72e3cb1..b6809b1766c007e2511a714e6412a315faafc874 100644 (file)
 #define _WNT_WClass_HeaderFile
 
 #include <Standard.hxx>
-#include <Standard_Type.hxx>
 
+#if defined(_WIN32) && !defined(OCCT_UWP)
+
+#include <Standard_Type.hxx>
 #include <Standard_CString.hxx>
 #include <Aspect_Handle.hxx>
 #include <Standard_Address.hxx>
@@ -80,24 +82,13 @@ friend class WNT_Window;
 
 protected:
 
-
   Standard_CString lpszName;
   Aspect_Handle hInstance;
   Standard_Address lpfnWndProc;
 
-
-private:
-
-
-
-
 };
 
-
 #include <WNT_WClass.lxx>
 
-
-
-
-
+#endif // _WIN32
 #endif // _WNT_WClass_HeaderFile
index 201853f00a94a043f16ceab201df513e11e79561..99f3bbd811024c0953c7fa3a2fef880a580254f9 100644 (file)
@@ -15,6 +15,9 @@
 // include windows.h first to have all definitions available
 #include <windows.h>
 
+#include <WNT_Window.hxx>
+
+#if defined(_WIN32) && !defined(OCCT_UWP)
 
 #include <Aspect_Convert.hxx>
 #include <Aspect_WindowDefinitionError.hxx>
@@ -22,7 +25,6 @@
 #include <Image_AlienPixMap.hxx>
 #include <Standard_Type.hxx>
 #include <WNT_WClass.hxx>
-#include <WNT_Window.hxx>
 
 #include <stdio.h>
 
@@ -354,3 +356,5 @@ void WNT_Window::SetPos (const Standard_Integer theX,  const Standard_Integer th
   aXRight  = theX1;
   aYBottom = theY1;
 }
+
+#endif // _WIN32
index b7b6f3c0f690088e13541558a5ec0271326336a6..6e0b78b4c044a95bbb05aef1ad029b5f4f1c9c08 100644 (file)
 #define _WNT_Window_HeaderFile
 
 #include <Standard.hxx>
-#include <Standard_Type.hxx>
 
+#if defined(_WIN32) && !defined(OCCT_UWP)
+
+#include <Standard_Type.hxx>
 #include <Standard_Integer.hxx>
 #include <Aspect_Handle.hxx>
 #include <Standard_Boolean.hxx>
@@ -118,7 +120,6 @@ public:
 
 protected:
 
-
   Standard_Integer aXLeft;
   Standard_Integer aYTop;
   Standard_Integer aXRight;
@@ -128,19 +129,9 @@ protected:
   Aspect_Handle myHParentWindow;
   Standard_Boolean myIsForeign;
 
-
-private:
-
-
-
-
 };
 
-
 #include <WNT_Window.lxx>
 
-
-
-
-
+#endif // _WIN32
 #endif // _WNT_Window_HeaderFile