91334d
From 6562e12885fa2abf1a1bf0d606b08e00c4547934 Mon Sep 17 00:00:00 2001
91334d
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
91334d
Date: Fri, 25 Nov 2016 20:25:27 +0000
91334d
Subject: [PATCH] change from glew to epoxy
91334d
91334d
cause that works under wayland out of the box and gtk3 uses it already
91334d
91334d
Change-Id: Iefaac31e325534a81a5389f752804af917c1baef
91334d
---
91334d
 Makefile.fetch                                     |  2 +-
91334d
 RepositoryExternal.mk                              | 46 +++++++++------------
91334d
 avmedia/Library_avmedia.mk                         |  2 +-
91334d
 avmedia/Library_avmediaogl.mk                      |  6 +--
91334d
 bin/check-elf-dynamic-objects                      |  2 +-
91334d
 bin/lo-all-static-libs                             |  2 +-
91334d
 canvas/Library_oglcanvas.mk                        |  7 +---
91334d
 canvas/source/opengl/ogl_buffercontext.hxx         |  2 +-
91334d
 canvas/source/opengl/ogl_canvascustomsprite.cxx    |  2 +-
91334d
 canvas/source/opengl/ogl_canvashelper.cxx          |  2 +-
91334d
 canvas/source/opengl/ogl_canvastools.cxx           |  2 +-
91334d
 canvas/source/opengl/ogl_texturecache.cxx          |  2 +-
91334d
 canvas/source/opengl/ogl_tools.hxx                 |  3 +-
91334d
 chart2/Library_chartcore.mk                        |  9 +---
91334d
 chart2/Library_chartopengl.mk                      |  4 +-
91334d
 chart2/inc/pch/precompiled_chartcore.hxx           |  2 +-
91334d
 chart2/source/view/charttypes/GL3DBarChart.cxx     |  2 +-
91334d
 chart2/source/view/main/GL3DRenderer.cxx           |  8 ++--
91334d
 chart2/source/view/main/OpenGLRender.cxx           |  2 +-
91334d
 config_host.mk.in                                  |  6 +--
91334d
 config_host/config_opengl.h.in                     | 10 -----
91334d
 configure.ac                                       | 21 +++++-----
91334d
 cui/Library_cui.mk                                 |  2 +-
91334d
 distro-configs/LibreOfficeFlatpak.conf             |  1 -
91334d
 download.lst                                       |  7 ++--
91334d
 external/Module_external.mk                        |  2 +-
91334d
 external/glew/ExternalPackage_glew.mk              | 33 ---------------
91334d
 external/glew/ExternalProject_glew.mk              | 36 ----------------
91334d
 external/glew/Makefile                             |  7 ----
91334d
 external/glew/Module_glew.mk                       | 18 --------
91334d
 external/glew/README                               |  6 ---
91334d
 external/glew/UnpackedTarball_glew.mk              | 48 ----------------------
91334d
 external/glew/glew-macosx-install-name.patch.1     | 13 ------
91334d
 external/glew/glew-msvc-disable-sse2.patch.1       | 10 -----
91334d
 external/glew/glew-static-only.patch.1             | 12 ------
91334d
 external/glew/glew-tmpdir.patch.1                  | 13 ------
91334d
 external/glew/glew_use_CC_variable.patch.1         | 24 -----------
91334d
 external/libgltf/ExternalProject_libgltf.mk        | 10 ++---
91334d
 external/libgltf/libgltf-msvc-x64.patch.1          | 31 +++++++-------
91334d
 include/vcl/opengl/OpenGLContext.hxx               |  6 +--
91334d
 include/vcl/opengl/OpenGLHelper.hxx                |  2 +-
91334d
 include/vcl/opengl/OpenGLWrapper.hxx               |  2 +-
91334d
 slideshow/Library_OGLTrans.mk                      |  9 +---
91334d
 slideshow/Library_slideshow.mk                     |  2 +-
91334d
 slideshow/source/engine/opengl/TransitionImpl.cxx  |  1 -
91334d
 slideshow/source/engine/opengl/TransitionImpl.hxx  |  3 +-
91334d
 .../source/engine/opengl/TransitionerImpl.cxx      |  2 +-
91334d
 svx/Library_svxcore.mk                             |  2 +-
91334d
 toolkit/Library_tk.mk                              |  2 +-
91334d
 vcl/CppunitTest_vcl_bitmap_test.mk                 |  2 +-
91334d
 vcl/CppunitTest_vcl_wmf_test.mk                    |  4 +-
91334d
 vcl/Executable_icontest.mk                         |  2 +-
91334d
 vcl/Executable_vcldemo.mk                          |  2 +-
91334d
 vcl/Executable_visualbackendtest.mk                |  1 -
91334d
 vcl/Library_vcl.mk                                 |  3 +-
91334d
 vcl/Library_vclplug_gen.mk                         |  3 +-
91334d
 vcl/Library_vclplug_gtk.mk                         |  2 +-
91334d
 vcl/Library_vclplug_gtk3.mk                        |  2 +-
91334d
 vcl/Library_vclplug_kde4.mk                        |  2 +-
91334d
 vcl/inc/opengl/LineRenderUtils.hxx                 |  1 -
91334d
 vcl/inc/opengl/VertexUtils.hxx                     |  2 +-
91334d
 vcl/inc/opengl/framebuffer.hxx                     |  1 -
91334d
 vcl/inc/opengl/program.hxx                         |  1 -
91334d
 vcl/inc/opengl/texture.hxx                         |  2 +-
91334d
 vcl/inc/pch/precompiled_vcl.hxx                    |  2 +-
91334d
 vcl/inc/unx/saldisp.hxx                            |  2 +-
91334d
 vcl/opengl/x11/gdiimpl.cxx                         | 31 ++++++--------
91334d
 vcl/osx/salobj.cxx                                 |  4 +-
91334d
 vcl/source/opengl/OpenGLContext.cxx                | 34 +++------------
91334d
 vcl/source/opengl/OpenGLHelper.cxx                 |  8 ++--
91334d
 vcl/unx/generic/app/saldisp.cxx                    |  1 -
91334d
 vcl/workben/icontest.cxx                           |  2 -
91334d
 72 files changed, 128 insertions(+), 434 deletions(-)
91334d
 delete mode 100644 config_host/config_opengl.h.in
91334d
 delete mode 100644 external/glew/ExternalPackage_glew.mk
91334d
 delete mode 100644 external/glew/ExternalProject_glew.mk
91334d
 delete mode 100644 external/glew/Makefile
91334d
 delete mode 100644 external/glew/Module_glew.mk
91334d
 delete mode 100644 external/glew/README
91334d
 delete mode 100644 external/glew/UnpackedTarball_glew.mk
91334d
 delete mode 100644 external/glew/glew-macosx-install-name.patch.1
91334d
 delete mode 100644 external/glew/glew-msvc-disable-sse2.patch.1
91334d
 delete mode 100644 external/glew/glew-static-only.patch.1
91334d
 delete mode 100644 external/glew/glew-tmpdir.patch.1
91334d
 delete mode 100644 external/glew/glew_use_CC_variable.patch.1
91334d
91334d
diff --git a/Makefile.fetch b/Makefile.fetch
91334d
index 3e21be3..cf31e5b 100644
91334d
--- a/Makefile.fetch
91334d
+++ b/Makefile.fetch
91334d
@@ -129,7 +129,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
91334d
 		$(call fetch_Optional,FONTCONFIG,FONTCONFIG_TARBALL) \
91334d
 		$(call fetch_Optional,FREEHAND,FREEHAND_TARBALL) \
91334d
 		$(call fetch_Optional,FREETYPE,FREETYPE_TARBALL) \
91334d
-		$(call fetch_Optional,GLEW,GLEW_TARBALL) \
91334d
+		$(call fetch_Optional,EPOXY,EPOXY_TARBALL) \
91334d
 		$(call fetch_Optional,GLM,GLM_TARBALL) \
91334d
 		$(call fetch_Optional_pack,GOOGLE_DOCS_EXTENSION_PACK) \
91334d
 		$(call fetch_Optional,GRAPHITE,GRAPHITE_TARBALL) \
91334d
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
91334d
index 109b924..16ba7a8 100644
91334d
--- a/RepositoryExternal.mk
91334d
+++ b/RepositoryExternal.mk
91334d
@@ -183,51 +183,43 @@ endef
91334d
 
91334d
 endif # SYSTEM_CPPUNIT
91334d
 
91334d
-ifneq ($(SYSTEM_GLEW),)
91334d
+ifneq ($(SYSTEM_EPOXY),)
91334d
 
91334d
-define gb_LinkTarget__use_glew
91334d
+define gb_LinkTarget__use_epoxy
91334d
 $(call gb_LinkTarget_set_include,$(1),\
91334d
 	$$(INCLUDE) \
91334d
-    $(GLEW_CFLAGS) \
91334d
+    $(EPOXY_CFLAGS) \
91334d
 )
91334d
-$(call gb_LinkTarget_add_libs,$(1),$(GLEW_LIBS))
91334d
+$(call gb_LinkTarget_add_libs,$(1),$(EPOXY_LIBS))
91334d
 
91334d
 endef
91334d
 
91334d
-gb_ExternalProject__use_glew :=
91334d
+gb_ExternalProject__use_epoxy :=
91334d
 
91334d
-else # !SYSTEM_GLEW
91334d
+else # !SYSTEM_EPOXY
91334d
 
91334d
-$(eval $(call gb_Helper_register_packages_for_install,ooo,\
91334d
-	glew \
91334d
-))
91334d
-
91334d
-define gb_LinkTarget__use_glew
91334d
-$(call gb_LinkTarget_use_package,$(1),glew)
91334d
+define gb_LinkTarget__use_epoxy
91334d
 $(call gb_LinkTarget_set_include,$(1),\
91334d
-	-I$(call gb_UnpackedTarball_get_dir,glew/include) \
91334d
-	-DGLEW_NO_GLU \
91334d
-	$$(INCLUDE) \
91334d
+       -I$(call gb_UnpackedTarball_get_dir,epoxy/include) \
91334d
+       $$(INCLUDE) \
91334d
 )
91334d
 
91334d
-ifeq ($(COM),MSC)
91334d
-$(call gb_LinkTarget_add_libs,$(1),\
91334d
-	$(call gb_UnpackedTarball_get_dir,glew)/lib/$(if $(MSVC_USE_DEBUG_RUNTIME),Debug/$(wnt_arch_subdir_mandatory)/glew32d.lib,Release/$(wnt_arch_subdir_mandatory)/glew32.lib) \
91334d
-)
91334d
-else
91334d
-$(call gb_LinkTarget_add_libs,$(1),\
91334d
-	-L$(call gb_UnpackedTarball_get_dir,glew)/lib/ -lGLEW \
91334d
+$(call gb_LinkTarget_use_libraries,$(1),\
91334d
+    epoxy \
91334d
 )
91334d
-endif
91334d
 
91334d
 endef
91334d
 
91334d
-define gb_ExternalProject__use_glew
91334d
-$(call gb_ExternalProject_use_external_project,$(1),glew)
91334d
+$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo,\
91334d
+	epoxy \
91334d
+))
91334d
+
91334d
+define gb_ExternalProject__use_epoxy
91334d
+$(call gb_ExternalProject_use_external_project,$(1),epoxy)
91334d
 
91334d
 endef
91334d
 
91334d
-endif # SYSTEM_GLEW
91334d
+endif # SYSTEM_EPOXY
91334d
 
91334d
 define gb_LinkTarget__use_iconv
91334d
 $(call gb_LinkTarget_add_libs,$(1),-liconv)
91334d
@@ -3444,7 +3436,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
91334d
 )
91334d
 else
91334d
 $(call gb_LinkTarget_add_libs,$(1),\
91334d
-	$(call gb_UnpackedTarball_get_dir,libgltf)/src/.libs/libgltf-0.0$(gb_StaticLibrary_PLAINEXT) \
91334d
+	$(call gb_UnpackedTarball_get_dir,libgltf)/src/.libs/libgltf-0.1$(gb_StaticLibrary_PLAINEXT) \
91334d
 )
91334d
 endif
91334d
 
91334d
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
91334d
index 4e8f3b1..e662fc3 100644
91334d
--- a/avmedia/Library_avmedia.mk
91334d
+++ b/avmedia/Library_avmedia.mk
91334d
@@ -29,7 +29,7 @@ $(eval $(call gb_Library_use_externals,avmedia,\
91334d
 
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,avmedia,\
91334d
-    glew \
91334d
+    epoxy \
91334d
 ))
91334d
 endif
91334d
 
91334d
diff --git a/avmedia/Library_avmediaogl.mk b/avmedia/Library_avmediaogl.mk
91334d
index b7498bf..191fb75 100644
91334d
--- a/avmedia/Library_avmediaogl.mk
91334d
+++ b/avmedia/Library_avmediaogl.mk
91334d
@@ -16,7 +16,7 @@ $(eval $(call gb_Library_use_sdk_api,avmediaogl))
91334d
 $(eval $(call gb_Library_use_externals,avmediaogl, \
91334d
     boost_headers \
91334d
     libgltf \
91334d
-    glew \
91334d
+    epoxy \
91334d
     glm_headers \
91334d
 ))
91334d
 
91334d
@@ -51,10 +51,6 @@ else ifeq ($(OS),MACOSX)
91334d
 $(eval $(call gb_Library_use_system_darwin_frameworks,avmediaogl,\
91334d
 	OpenGL \
91334d
 ))
91334d
-else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
91334d
-$(eval $(call gb_Library_add_libs,avmediaogl,\
91334d
-    -lGL \
91334d
-))
91334d
 endif
91334d
 
91334d
 # vim: set noet sw=4 ts=4:
91334d
diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
91334d
index f05d513..d189c1b 100755
91334d
--- a/bin/check-elf-dynamic-objects
91334d
+++ b/bin/check-elf-dynamic-objects
91334d
@@ -110,7 +110,7 @@ local file="$1"
91334d
         */libdesktop_detectorlo.so|*/ui-previewer|*/oosplash|*/gengal.bin)
91334d
             whitelist="${whitelist} ${x11whitelist}"
91334d
         ;;
91334d
-        */libvclplug_genlo.so|*/libGLEW.so.*|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
91334d
+        */libvclplug_genlo.so|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
91334d
             whitelist="${whitelist} ${x11whitelist} ${openglwhitelist}"
91334d
         ;;
91334d
         */libvcllo.so|*/libsofficeapp.so)
91334d
diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs
91334d
index 813241e..9faa042 100755
91334d
--- a/bin/lo-all-static-libs
91334d
+++ b/bin/lo-all-static-libs
91334d
@@ -63,7 +63,7 @@ echo $INSTDIR/$LIBO_LIB_FOLDER/lib*.a \
91334d
      $WORKDIR/UnpackedTarball/coinmp/CoinMP/src/.libs/*.a \
91334d
      $WORKDIR/UnpackedTarball/coinmp/CoinUtils/src/.libs/*.a \
91334d
      $WORKDIR/UnpackedTarball/coinmp/Osi/src/Osi/.libs/*.a \
91334d
-     $WORKDIR/UnpackedTarball/glew/lib/*.a \
91334d
+     $WORKDIR/UnpackedTarball/epoxy/lib/*.a \
91334d
      $WORKDIR/UnpackedTarball/icu/source/lib/*.a \
91334d
      $WORKDIR/UnpackedTarball/langtag/liblangtag/.libs/*.a \
91334d
      $WORKDIR/UnpackedTarball/lcms2/src/.libs/*.a \
91334d
diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
91334d
index 0118eb1..9d1042d 100644
91334d
--- a/canvas/Library_oglcanvas.mk
91334d
+++ b/canvas/Library_oglcanvas.mk
91334d
@@ -42,7 +42,7 @@ $(eval $(call gb_Library_add_exception_objects,oglcanvas,\
91334d
 
91334d
 $(eval $(call gb_Library_use_externals,oglcanvas,\
91334d
 	boost_headers \
91334d
-	glew \
91334d
+	epoxy \
91334d
 ))
91334d
 
91334d
 ifeq ($(strip $(OS)),MACOSX)
91334d
@@ -58,11 +58,6 @@ $(eval $(call gb_Library_use_system_win32_libs,oglcanvas,\
91334d
     opengl32 \
91334d
 ))
91334d
 
91334d
-else
91334d
-$(eval $(call gb_Library_add_libs,oglcanvas,\
91334d
-    -lGL \
91334d
-    -lX11 \
91334d
-))
91334d
 endif
91334d
 
91334d
 # vim: set noet sw=4 ts=4:
91334d
diff --git a/canvas/source/opengl/ogl_buffercontext.hxx b/canvas/source/opengl/ogl_buffercontext.hxx
91334d
index 202e063..7f2066a 100644
91334d
--- a/canvas/source/opengl/ogl_buffercontext.hxx
91334d
+++ b/canvas/source/opengl/ogl_buffercontext.hxx
91334d
@@ -10,7 +10,7 @@
91334d
 #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BUFFERCONTEXT_HXX
91334d
 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BUFFERCONTEXT_HXX
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <sal/config.h>
91334d
 #include <memory>
91334d
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
91334d
index 8d38177..6b23d45 100644
91334d
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
91334d
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
91334d
@@ -9,7 +9,7 @@
91334d
 
91334d
 #include <sal/config.h>
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <basegfx/matrix/b2dhommatrix.hxx>
91334d
 #include <basegfx/point/b2dpoint.hxx>
91334d
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
91334d
index 84a96ce..175a02b 100644
91334d
--- a/canvas/source/opengl/ogl_canvashelper.cxx
91334d
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
91334d
@@ -11,7 +11,7 @@
91334d
 
91334d
 #include <memory>
91334d
 #include <functional>
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <basegfx/polygon/b2dpolygontriangulator.hxx>
91334d
 #include <basegfx/polygon/b2dpolypolygon.hxx>
91334d
diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
91334d
index 657a220..3d9448b 100644
91334d
--- a/canvas/source/opengl/ogl_canvastools.cxx
91334d
+++ b/canvas/source/opengl/ogl_canvastools.cxx
91334d
@@ -9,7 +9,7 @@
91334d
 
91334d
 #include <sal/config.h>
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <basegfx/matrix/b2dhommatrix.hxx>
91334d
 #include <basegfx/polygon/b2dpolygontriangulator.hxx>
91334d
diff --git a/canvas/source/opengl/ogl_texturecache.cxx b/canvas/source/opengl/ogl_texturecache.cxx
91334d
index 08cdd2f..43fb7d8 100644
91334d
--- a/canvas/source/opengl/ogl_texturecache.cxx
91334d
+++ b/canvas/source/opengl/ogl_texturecache.cxx
91334d
@@ -9,7 +9,7 @@
91334d
 
91334d
 #include <sal/config.h>
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <com/sun/star/geometry/IntegerSize2D.hpp>
91334d
 
91334d
diff --git a/canvas/source/opengl/ogl_tools.hxx b/canvas/source/opengl/ogl_tools.hxx
91334d
index 8133212..469a5be 100644
91334d
--- a/canvas/source/opengl/ogl_tools.hxx
91334d
+++ b/canvas/source/opengl/ogl_tools.hxx
91334d
@@ -11,8 +11,7 @@
91334d
 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_TOOLS_HXX
91334d
 
91334d
 #include <sal/config.h>
91334d
-#include <GL/glew.h>
91334d
-
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 namespace oglcanvas
91334d
 {
91334d
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
91334d
index b15f634..cc06fbd 100644
91334d
--- a/chart2/Library_chartcore.mk
91334d
+++ b/chart2/Library_chartcore.mk
91334d
@@ -32,7 +32,7 @@ $(eval $(call gb_Library_use_externals,chartcore,\
91334d
 
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,chartcore,\
91334d
-    glew \
91334d
+    epoxy \
91334d
 ))
91334d
 endif
91334d
 
91334d
@@ -264,13 +264,6 @@ else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
91334d
 $(eval $(call gb_Library_add_libs,chartcore,\
91334d
 	$(DLOPEN_LIBS) \
91334d
 ))
91334d
-ifeq ($(ENABLE_HEADLESS),)
91334d
-$(eval $(call gb_Library_add_libs,chartcore,\
91334d
-    -lGL \
91334d
-    -lX11 \
91334d
-))
91334d
-endif #!ENABLE_HEADLESS
91334d
-
91334d
 endif
91334d
 
91334d
 # vim: set noet sw=4 ts=4:
91334d
diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk
91334d
index 95ea58d..53056aa 100644
91334d
--- a/chart2/Library_chartopengl.mk
91334d
+++ b/chart2/Library_chartopengl.mk
91334d
@@ -22,7 +22,7 @@ $(eval $(call gb_Library_set_precompiled_header,chartopengl,$(SRCDIR)/chart2/inc
91334d
 $(eval $(call gb_Library_use_externals,chartopengl,\
91334d
 	boost_headers \
91334d
 	glm_headers \
91334d
-	glew \
91334d
+	epoxy \
91334d
 ))
91334d
 
91334d
 $(eval $(call gb_Library_use_sdk_api,chartopengl))
91334d
@@ -68,8 +68,6 @@ $(eval $(call gb_Library_use_system_darwin_frameworks,chartopengl,\
91334d
 else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
91334d
 $(eval $(call gb_Library_add_libs,chartopengl,\
91334d
 	$(DLOPEN_LIBS) \
91334d
-	-lGL \
91334d
-	-lX11 \
91334d
 ))
91334d
 endif
91334d
  
91334d
diff --git a/chart2/inc/pch/precompiled_chartcore.hxx b/chart2/inc/pch/precompiled_chartcore.hxx
91334d
index 8d02451..908d7ac 100644
91334d
--- a/chart2/inc/pch/precompiled_chartcore.hxx
91334d
+++ b/chart2/inc/pch/precompiled_chartcore.hxx
91334d
@@ -73,7 +73,6 @@
91334d
 #include <vcl/virdev.hxx>
91334d
 #include <vcl/wall.hxx>
91334d
 #include <ChartModel.hxx>
91334d
-#include <GL/glew.h>
91334d
 #include <basegfx/basegfxdllapi.h>
91334d
 #include <basegfx/matrix/b3dhommatrix.hxx>
91334d
 #include <basegfx/numeric/ftools.hxx>
91334d
@@ -169,6 +168,7 @@
91334d
 #include <cppuhelper/weak.hxx>
91334d
 #include <editeng/editengdllapi.h>
91334d
 #include <editeng/unoprnms.hxx>
91334d
+#include <epoxy/gl.h>
91334d
 #include <i18nlangtag/i18nlangtagdllapi.h>
91334d
 #include <i18nlangtag/lang.h>
91334d
 #include <i18nlangtag/languagetag.hxx>
91334d
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
91334d
index a4193da..401b664 100644
91334d
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
91334d
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
91334d
@@ -9,7 +9,7 @@
91334d
 
91334d
 #include <GL3DBarChart.hxx>
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <glm/glm.hpp>
91334d
 #include <glm/gtx/transform.hpp>
91334d
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
91334d
index fb4fb13..e1e4c01 100644
91334d
--- a/chart2/source/view/main/GL3DRenderer.cxx
91334d
+++ b/chart2/source/view/main/GL3DRenderer.cxx
91334d
@@ -7,7 +7,7 @@
91334d
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
  */
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include "GL3DRenderer.hxx"
91334d
 
91334d
@@ -244,8 +244,8 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
91334d
         m_3DBatchNormalID = glGetAttribLocation(m_3DBatchProID, "vertexNormalModelspace");
91334d
         m_3DBatchColorID = glGetAttribLocation(m_3DBatchProID, "barColor");
91334d
 #if !defined MACOSX
91334d
-        //check whether the texture array is support
91334d
-        mbTexBatchSupport = GLEW_EXT_texture_array;
91334d
+        //check whether the texture array is supported
91334d
+        mbTexBatchSupport = epoxy_has_gl_extension("GL_EXT_texture_array");
91334d
 #endif
91334d
         CHECK_GL_ERROR();
91334d
         if (mbTexBatchSupport)
91334d
@@ -401,7 +401,7 @@ void OpenGL3DRenderer::init()
91334d
     m_fViewAngle = 30.0f;
91334d
     m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 6000.0f);
91334d
 
91334d
-    maResources.m_b330Support = GLEW_VERSION_3_3;
91334d
+    maResources.m_b330Support = epoxy_gl_version() >= 33;
91334d
     CHECK_GL_ERROR();
91334d
     maResources.LoadShaders();
91334d
     maPickingResources.LoadShaders();
91334d
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
91334d
index 3182e66..91a3763 100644
91334d
--- a/chart2/source/view/main/OpenGLRender.cxx
91334d
+++ b/chart2/source/view/main/OpenGLRender.cxx
91334d
@@ -7,7 +7,7 @@
91334d
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
  */
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 #include <vector>
91334d
 #include "OpenGLRender.hxx"
91334d
 #include <vcl/graph.hxx>
91334d
diff --git a/config_host.mk.in b/config_host.mk.in
91334d
index 3d39dcd..2a8fe3d 100644
91334d
--- a/config_host.mk.in
91334d
+++ b/config_host.mk.in
91334d
@@ -201,8 +201,8 @@ export GIO_LIBS=$(gb_SPACE)@GIO_LIBS@
91334d
 export GIT_REFERENCE_SRC=@GIT_REFERENCE_SRC@
91334d
 export GIT_LINK_SRC=@GIT_LINK_SRC@
91334d
 export GIT_NEEDED_SUBMODULES=@GIT_NEEDED_SUBMODULES@
91334d
-export GLEW_CFLAGS=$(gb_SPACE)@GLEW_CFLAGS@
91334d
-export GLEW_LIBS=$(gb_SPACE)@GLEW_LIBS@
91334d
+export EPOXY_CFLAGS=$(gb_SPACE)@EPOXY_CFLAGS@
91334d
+export EPOXY_LIBS=$(gb_SPACE)@EPOXY_LIBS@
91334d
 export GLM_CFLAGS=$(gb_SPACE)@GLM_CFLAGS@
91334d
 export GNOMEVFS_CFLAGS=$(gb_SPACE)@GNOMEVFS_CFLAGS@
91334d
 export GNOMEVFS_LIBS=$(gb_SPACE)@GNOMEVFS_LIBS@
91334d
@@ -514,7 +514,7 @@ export SYSTEM_FIREBIRD=@SYSTEM_FIREBIRD@
91334d
 export SYSTEM_GENBRK=@SYSTEM_GENBRK@
91334d
 export SYSTEM_GENCCODE=@SYSTEM_GENCCODE@
91334d
 export SYSTEM_GENCMN=@SYSTEM_GENCMN@
91334d
-export SYSTEM_GLEW=@SYSTEM_GLEW@
91334d
+export SYSTEM_EPOXY=@SYSTEM_EPOXY@
91334d
 export SYSTEM_GLM=@SYSTEM_GLM@
91334d
 export SYSTEM_GRAPHITE=@SYSTEM_GRAPHITE@
91334d
 export SYSTEM_HARFBUZZ=@SYSTEM_HARFBUZZ@
91334d
diff --git a/config_host/config_opengl.h.in b/config_host/config_opengl.h.in
91334d
deleted file mode 100644
91334d
index 67b9e47..0000000
91334d
--- a/config_host/config_opengl.h.in
91334d
+++ /dev/null
91334d
@@ -1,10 +0,0 @@
91334d
-/*
91334d
-Settings for OpenGL
91334d
-*/
91334d
-
91334d
-#ifndef CONFIG_OPENGL_H
91334d
-#define CONFIG_OPENGL_H
91334d
-
91334d
-#define HAVE_GLEW_1_12 0
91334d
-
91334d
-#endif
91334d
diff --git a/configure.ac b/configure.ac
91334d
index 7fdcc65..f8b5df8 100644
91334d
--- a/configure.ac
91334d
+++ b/configure.ac
91334d
@@ -1645,6 +1645,11 @@ AC_ARG_WITH(system-cairo,
91334d
         [Use cairo libraries already on system.  Happens automatically for
91334d
          (implicit) --enable-gtk and for --enable-gtk3.]))
91334d
 
91334d
+AC_ARG_WITH(system-epoxy,
91334d
+    AS_HELP_STRING([--with-system-epoxy],
91334d
+        [Use epoxy libraries already on system.  Happens automatically for
91334d
+         --enable-gtk3.]))
91334d
+
91334d
 AC_ARG_WITH(myspell-dicts,
91334d
     AS_HELP_STRING([--with-myspell-dicts],
91334d
         [Adds myspell dictionaries to the LibreOffice installation set]),
91334d
@@ -8952,14 +8957,6 @@ AC_SUBST([GLM_CFLAGS])
91334d
 AC_SUBST([SYSTEM_GLM])
91334d
 
91334d
 dnl ===================================================================
91334d
-dnl Check for system glew
91334d
-dnl ===================================================================
91334d
-libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
91334d
-AS_IF([test "$with_system_glew" = "yes"],
91334d
-    [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
91334d
-    [AC_DEFINE([HAVE_GLEW_1_12])])
91334d
-
91334d
-dnl ===================================================================
91334d
 dnl Check for system odbc
91334d
 dnl ===================================================================
91334d
 AC_MSG_CHECKING([which odbc headers to use])
91334d
@@ -10508,7 +10505,7 @@ if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_H
91334d
     AC_DEFINE(HAVE_FEATURE_GLTF,1)
91334d
     if test "$with_system_libgltf" = "yes"; then
91334d
         SYSTEM_LIBGLTF=TRUE
91334d
-        PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
91334d
+        PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.1 >= 0.1.0] )
91334d
         FilterLibs "${LIBGLTF_LIBS}"
91334d
         LIBGLTF_LIBS="${filteredlibs}"
91334d
     else
91334d
@@ -11739,6 +11736,11 @@ AC_SUBST(CAIRO_CFLAGS)
91334d
 AC_SUBST(CAIRO_LIBS)
91334d
 
91334d
 dnl ===================================================================
91334d
+dnl Check for system epoxy
91334d
+dnl ===================================================================
91334d
+libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.3.1], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
91334d
+
91334d
+dnl ===================================================================
91334d
 dnl Test whether to use avahi
91334d
 dnl ===================================================================
91334d
 if test "$_os" = "WINNT"; then
91334d
@@ -12897,7 +12899,6 @@ AC_CONFIG_HEADERS([config_host/config_mpl.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_orcus.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_kde4.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_oox.h])
91334d
-AC_CONFIG_HEADERS([config_host/config_opengl.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_options.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
91334d
 AC_CONFIG_HEADERS([config_host/config_test.h])
91334d
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
91334d
index 6a63a1d..64f7844 100644
91334d
--- a/cui/Library_cui.mk
91334d
+++ b/cui/Library_cui.mk
91334d
@@ -72,7 +72,7 @@ $(eval $(call gb_Library_use_externals,cui,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,cui,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
diff --git a/distro-configs/LibreOfficeFlatpak.conf b/distro-configs/LibreOfficeFlatpak.conf
91334d
index a7a0c73..d85e8ea 100644
91334d
--- a/distro-configs/LibreOfficeFlatpak.conf
91334d
+++ b/distro-configs/LibreOfficeFlatpak.conf
91334d
@@ -11,7 +11,6 @@
91334d
 --without-system-coinmp
91334d
 --without-system-cppunit
91334d
 --without-system-firebird
91334d
---without-system-glew
91334d
 --without-system-glm
91334d
 --without-system-libabw
91334d
 --without-system-libcdr
91334d
diff --git a/download.lst b/download.lst
91334d
index 4c67612..49d659a 100644
91334d
--- a/download.lst
91334d
+++ b/download.lst
91334d
@@ -29,6 +29,8 @@ export CURL_TARBALL := curl-7.52.1.tar.gz
91334d
 export DBGHELP_DLL := 13fbc2e8b37ddf28181dd6d8081c2b8e-dbghelp.dll
91334d
 export EBOOK_MD5SUM := 6b48eda57914e6343efebc9381027b78
91334d
 export EBOOK_TARBALL := libe-book-0.1.2.tar.bz2
91334d
+export EPOXY_MD5SUM := 96f6620a9b005a503e7b44b0b528287d
91334d
+export EPOXY_TARBALL := libepoxy-1.3.1.tar.bz2
91334d
 export EPM_TARBALL := 3ade8cfe7e59ca8e65052644fed9fca4-epm-3.7.tar.gz
91334d
 export ETONYEK_MD5SUM := 77ff46936dcc83670557274e7dd2aa33
91334d
 export ETONYEK_VERSION_MICRO := 6
91334d
@@ -54,7 +56,6 @@ export FONT_EMOJIONE_COLOR_TARBALL := EmojiOneColor-SVGinOT-1.3.tar.gz
91334d
 export FREEHAND_MD5SUM := 8cf70c5dc4d24d2dc4a107f509d2d6d7
91334d
 export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
91334d
 export FREETYPE_TARBALL := dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
91334d
-export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
91334d
 export GLM_TARBALL := bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
91334d
 export GRAPHITE_MD5SUM := 9c499b8ec9f1b81fd0bb6a3b986f4b0f
91334d
 export GRAPHITE_TARBALL := graphite2-minimal-1.3.10.tgz
91334d
@@ -89,8 +90,8 @@ export LIBATOMIC_OPS_TARBALL := libatomic_ops-7_2d.zip
91334d
 export LIBEOT_MD5SUM := aa24f5dd2a2992f4a116aa72af817548
91334d
 export LIBEOT_TARBALL := libeot-0.01.tar.bz2
91334d
 export LIBEXTTEXTCAT_TARBALL := 10d61fbaa6a06348823651b1bd7940fe-libexttextcat-3.4.4.tar.bz2
91334d
-export LIBGLTF_MD5SUM := d63a9f47ab048f5009d90693d6aa6424
91334d
-export LIBGLTF_TARBALL := libgltf-0.0.2.tar.bz2
91334d
+export LIBGLTF_MD5SUM := 63ae962d0c436909979826fce0fca2fd
91334d
+export LIBGLTF_TARBALL := libgltf-0.1.0.tar.gz
91334d
 export LIBLANGTAG_MD5SUM := 284f120247323a35122ab32b4b359c45
91334d
 export LIBLANGTAG_TARBALL := liblangtag-0.6.2.tar.bz2
91334d
 export LIBTOMMATH_MD5SUM := da283d2e3e72137d0c600ac36b991c9d
91334d
diff --git a/external/Module_external.mk b/external/Module_external.mk
91334d
index 1dbf97b..c14e668 100644
91334d
--- a/external/Module_external.mk
91334d
+++ b/external/Module_external.mk
91334d
@@ -38,13 +38,13 @@ $(eval $(call gb_Module_add_moduledirs,external,\
91334d
 	$(call gb_Helper_optional,CURL,curl) \
91334d
 	$(call gb_Helper_optional,EBOOK,libebook) \
91334d
 	$(call gb_Helper_optional,EPM,epm) \
91334d
+	$(call gb_Helper_optional,EPOXY,epoxy) \
91334d
 	$(call gb_Helper_optional,ETONYEK,libetonyek) \
91334d
 	$(call gb_Helper_optional,EXPAT,expat) \
91334d
 	$(call gb_Helper_optional,FIREBIRD,firebird) \
91334d
 	$(call gb_Helper_optional,FONTCONFIG,fontconfig) \
91334d
 	$(call gb_Helper_optional,FREEHAND,libfreehand) \
91334d
 	$(call gb_Helper_optional,FREETYPE,freetype) \
91334d
-	$(call gb_Helper_optional,GLEW,glew) \
91334d
 	$(call gb_Helper_optional,GLM,glm) \
91334d
 	$(call gb_Helper_optional,GRAPHITE,graphite) \
91334d
 	$(call gb_Helper_optional,HARFBUZZ,harfbuzz) \
91334d
diff --git a/external/glew/ExternalPackage_glew.mk b/external/glew/ExternalPackage_glew.mk
91334d
deleted file mode 100644
91334d
index e6adc8b..0000000
91334d
--- a/external/glew/ExternalPackage_glew.mk
91334d
+++ /dev/null
91334d
@@ -1,33 +0,0 @@
91334d
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
91334d
-#
91334d
-# This file is part of the LibreOffice project.
91334d
-#
91334d
-# This Source Code Form is subject to the terms of the Mozilla Public
91334d
-# License, v. 2.0. If a copy of the MPL was not distributed with this
91334d
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
-#
91334d
-
91334d
-$(eval $(call gb_ExternalPackage_ExternalPackage,glew,glew))
91334d
-
91334d
-$(eval $(call gb_ExternalPackage_use_external_project,glew,glew))
91334d
-
91334d
-ifeq ($(OS)-$(COM),WNT-MSC)
91334d
-ifeq ($(CPUNAME),INTEL)
91334d
-glew_arch_subdir=Win32
91334d
-else ifeq ($(CPUNAME),X86_64)
91334d
-glew_arch_subdir=x64
91334d
-endif
91334d
-endif
91334d
-
91334d
-ifeq ($(OS),MACOSX)
91334d
-$(eval $(call gb_ExternalPackage_add_file,glew,$(LIBO_LIB_FOLDER)/libGLEW.1.12.0.dylib,lib/libGLEW.1.12.0.dylib))
91334d
-else ifeq ($(OS)-$(COM),WNT-GCC)
91334d
-else ifeq ($(COM),MSC)
91334d
-$(eval $(call gb_ExternalPackage_add_files,glew,$(LIBO_LIB_FOLDER), \
91334d
-	bin/$(if $(MSVC_USE_DEBUG_RUNTIME),Debug/$(glew_arch_subdir)/glew32d.dll,Release/$(glew_arch_subdir)/glew32.dll) \
91334d
-))
91334d
-else ifeq ($(DISABLE_DYNLOADING),)
91334d
-$(eval $(call gb_ExternalPackage_add_file,glew,$(LIBO_LIB_FOLDER)/libGLEW.so.1.12,lib/libGLEW.so.1.12.0))
91334d
-endif
91334d
-
91334d
-# vim: set noet sw=4 ts=4:
91334d
diff --git a/external/glew/ExternalProject_glew.mk b/external/glew/ExternalProject_glew.mk
91334d
deleted file mode 100644
91334d
index 0d80cd0..0000000
91334d
--- a/external/glew/ExternalProject_glew.mk
91334d
+++ /dev/null
91334d
@@ -1,36 +0,0 @@
91334d
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
91334d
-#
91334d
-# This file is part of the LibreOffice project.
91334d
-#
91334d
-# This Source Code Form is subject to the terms of the Mozilla Public
91334d
-# License, v. 2.0. If a copy of the MPL was not distributed with this
91334d
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
-#
91334d
-
91334d
-$(eval $(call gb_ExternalProject_ExternalProject,glew))
91334d
-
91334d
-$(eval $(call gb_ExternalProject_register_targets,glew,\
91334d
-	build \
91334d
-))
91334d
-
91334d
-ifeq ($(COM),MSC)
91334d
-$(call gb_ExternalProject_get_state_target,glew,build) :
91334d
-	$(call gb_ExternalProject_run,build,\
91334d
-		$(if $(filter 140,$(VCVER)),$(DEVENV) /Upgrade glew.sln,echo up-to-date) && \
91334d
-		msbuild.exe glew_shared.vcxproj /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) $(if $(filter 140,$(VCVER)),/p:PlatformToolset=v140,/p:PlatformToolset=v120) \
91334d
-	,build/vc12) \
91334d
-	$(call gb_ExternalProject_run,build,\
91334d
-		msbuild.exe glewinfo.vcxproj /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) /p:Configuration=Release $(if $(filter 140,$(VCVER)),/p:PlatformToolset=v140,/p:PlatformToolset=v120) \
91334d
-	,build/vc12)
91334d
-
91334d
-else
91334d
-
91334d
-$(call gb_ExternalProject_get_state_target,glew,build) :
91334d
-	$(call gb_ExternalProject_run,glew,\
91334d
-		$(if $(ENABLE_DEBUG),STRIP=) LD="$(CC)" \
91334d
-			$(MAKE) STRIP= glew.lib $(if $(filter DESKTOP,$(BUILD_TYPE)),$(if $(ENABLE_DEBUG),debug)) \
91334d
-	)
91334d
-
91334d
-endif
91334d
-
91334d
-# vim: set noet sw=4 ts=4:
91334d
diff --git a/external/glew/Makefile b/external/glew/Makefile
91334d
deleted file mode 100644
91334d
index e4968cf..0000000
91334d
--- a/external/glew/Makefile
91334d
+++ /dev/null
91334d
@@ -1,7 +0,0 @@
91334d
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
91334d
-
91334d
-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
91334d
-
91334d
-include $(module_directory)/../../solenv/gbuild/partial_build.mk
91334d
-
91334d
-# vim: set noet sw=4 ts=4:
91334d
diff --git a/external/glew/Module_glew.mk b/external/glew/Module_glew.mk
91334d
deleted file mode 100644
91334d
index 1d1b9a7..0000000
91334d
--- a/external/glew/Module_glew.mk
91334d
+++ /dev/null
91334d
@@ -1,18 +0,0 @@
91334d
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
91334d
-#
91334d
-# This file is part of the LibreOffice project.
91334d
-#
91334d
-# This Source Code Form is subject to the terms of the Mozilla Public
91334d
-# License, v. 2.0. If a copy of the MPL was not distributed with this
91334d
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
-#
91334d
-
91334d
-$(eval $(call gb_Module_Module,glew))
91334d
-
91334d
-$(eval $(call gb_Module_add_targets,glew,\
91334d
-	ExternalProject_glew \
91334d
-	UnpackedTarball_glew \
91334d
-	ExternalPackage_glew \
91334d
-))
91334d
-
91334d
-# vim: set noet sw=4 ts=4:
91334d
diff --git a/external/glew/README b/external/glew/README
91334d
deleted file mode 100644
91334d
index 34b2d24..0000000
91334d
--- a/external/glew/README
91334d
+++ /dev/null
91334d
@@ -1,6 +0,0 @@
91334d
-GLEW is the OpenGL Extension Wrangler
91334d
-
91334d
-GLEW provides efficient run-time mechanisms for determining which OpenGL
91334d
-extensions are supported on the target platform.
91334d
-
91334d
-http://glew.sourceforge.net/
91334d
diff --git a/external/glew/UnpackedTarball_glew.mk b/external/glew/UnpackedTarball_glew.mk
91334d
deleted file mode 100644
91334d
index c47b7a0..0000000
91334d
--- a/external/glew/UnpackedTarball_glew.mk
91334d
+++ /dev/null
91334d
@@ -1,48 +0,0 @@
91334d
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
91334d
-#
91334d
-# This file is part of the LibreOffice project.
91334d
-#
91334d
-# This Source Code Form is subject to the terms of the Mozilla Public
91334d
-# License, v. 2.0. If a copy of the MPL was not distributed with this
91334d
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
-#
91334d
-
91334d
-$(eval $(call gb_UnpackedTarball_UnpackedTarball,glew))
91334d
-
91334d
-$(eval $(call gb_UnpackedTarball_set_tarball,glew,$(GLEW_TARBALL)))
91334d
-
91334d
-$(eval $(call gb_UnpackedTarball_set_patchlevel,glew,0))
91334d
-
91334d
-$(eval $(call gb_UnpackedTarball_fix_end_of_line,glew,\
91334d
-	Makefile \
91334d
-	include/GL/glew.h \
91334d
-))
91334d
-
91334d
-ifeq ($(OS)$(COM),WNTMSC)
91334d
-$(eval $(call gb_UnpackedTarball_set_patchflags,glew,--binary))
91334d
-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
91334d
-	external/glew/glew-msvc-disable-sse2.patch.1 \
91334d
-))
91334d
-else
91334d
-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
91334d
-	external/glew/glew_use_CC_variable.patch.1 \
91334d
-))
91334d
-endif
91334d
-
91334d
-ifeq ($(OS),MACOSX)
91334d
-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
91334d
-	external/glew/glew-macosx-install-name.patch.1 \
91334d
-))
91334d
-endif
91334d
-
91334d
-ifeq ($(DISABLE_DYNLOADING),TRUE)
91334d
-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
91334d
-	external/glew/glew-static-only.patch.1 \
91334d
-))
91334d
-endif
91334d
-
91334d
-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
91334d
-	external/glew/glew-tmpdir.patch.1 \
91334d
-))
91334d
-
91334d
-# vim: set noet sw=4 ts=4:
91334d
diff --git a/external/glew/glew-macosx-install-name.patch.1 b/external/glew/glew-macosx-install-name.patch.1
91334d
deleted file mode 100644
91334d
index 75e8e7f..0000000
91334d
--- a/external/glew/glew-macosx-install-name.patch.1
91334d
+++ /dev/null
91334d
@@ -1,13 +0,0 @@
91334d
--*- Mode:Diff -*-
91334d
-diff -ur glew.org/build/glew.rc glew/build/glew.rc
91334d
---- glew/config/Makefile.darwin
91334d
-+++ glew/config/Makefile.darwin
91334d
-@@ -20,7 +20,7 @@
91334d
- LIB.DEVLNK    = lib$(NAME).dylib
91334d
- LIB.SHARED    = lib$(NAME).$(SO_VERSION).dylib
91334d
- LIB.STATIC    = lib$(NAME).a
91334d
--LDFLAGS.SO    = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
91334d
-+LDFLAGS.SO    = -dynamiclib -install_name @__________________________________________________OOO/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
91334d
- LIB.SONAME.MX = lib$(NAME)mx.$(SO_MAJOR).dylib
91334d
- LIB.DEVLNK.MX = lib$(NAME)mx.dylib
91334d
- LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib
91334d
diff --git a/external/glew/glew-msvc-disable-sse2.patch.1 b/external/glew/glew-msvc-disable-sse2.patch.1
91334d
deleted file mode 100644
91334d
index 6b07044..0000000
91334d
--- a/external/glew/glew-msvc-disable-sse2.patch.1
91334d
+++ /dev/null
91334d
@@ -1,10 +0,0 @@
91334d
---- glew/build//vc10/common.props.orig	2014-10-02 15:06:57.027060664 +0200
91334d
-+++ glew/build//vc10/common.props	2014-10-02 15:06:59.026060509 +0200
91334d
-@@ -10,6 +10,7 @@
91334d
-   <ItemDefinitionGroup>
91334d
-     <ClCompile>
91334d
-       <AdditionalIncludeDirectories>$(INCLUDE_DIR)</AdditionalIncludeDirectories>
91334d
-+      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
91334d
-     </ClCompile>
91334d
-   </ItemDefinitionGroup>
91334d
-   <ItemGroup>
91334d
diff --git a/external/glew/glew-static-only.patch.1 b/external/glew/glew-static-only.patch.1
91334d
deleted file mode 100644
91334d
index 14ccff2..0000000
91334d
--- a/external/glew/glew-static-only.patch.1
91334d
+++ /dev/null
91334d
@@ -1,12 +0,0 @@
91334d
--*- Mode:Diff -*-
91334d
---- glew/Makefile
91334d
-+++ glew/Makefile
91334d
-@@ -93,7 +93,7 @@
91334d
- LIB.SOBJS.MX       := $(addprefix tmp/$(SYSTEM)/mx/shared/,$(LIB.SRCS.NAMES))
91334d
- LIB.SOBJS.MX       := $(LIB.SOBJS.MX:.c=.o)
91334d
- 
91334d
--glew.lib: lib lib/$(LIB.SHARED) lib/$(LIB.STATIC) glew.pc
91334d
-+glew.lib: lib lib/$(LIB.STATIC)
91334d
- 
91334d
- lib:
91334d
- 	mkdir lib
91334d
diff --git a/external/glew/glew-tmpdir.patch.1 b/external/glew/glew-tmpdir.patch.1
91334d
deleted file mode 100644
91334d
index 9a2847b..0000000
91334d
--- a/external/glew/glew-tmpdir.patch.1
91334d
+++ /dev/null
91334d
@@ -1,13 +0,0 @@
91334d
-diff -ur glew.org/Makefile glew/Makefile
91334d
---- glew.org/Makefile	2016-05-02 06:25:53.521291677 +0200
91334d
-+++ glew/Makefile	2016-05-02 06:31:10.325035494 +0200
91334d
-@@ -55,7 +55,8 @@
91334d
- DIST_SRC_TGZ ?= $(shell pwd)/$(DIST_NAME).tgz
91334d
- DIST_WIN32   ?= $(shell pwd)/$(DIST_NAME)-win32.zip
91334d
- 
91334d
--DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME)
91334d
-+TMPDIR ?= /tmp
91334d
-+DIST_DIR := $(shell mktemp -d $(TMPDIR)/glew.XXXXXX)/$(DIST_NAME)
91334d
- 
91334d
- # To disable stripping of binaries either:
91334d
- #   - use STRIP= on gmake command-line
91334d
diff --git a/external/glew/glew_use_CC_variable.patch.1 b/external/glew/glew_use_CC_variable.patch.1
91334d
deleted file mode 100644
91334d
index 56e9903..0000000
91334d
--- a/external/glew/glew_use_CC_variable.patch.1
91334d
+++ /dev/null
91334d
@@ -1,24 +0,0 @@
91334d
-Use CC variable from environment, don't hardcode "cc".
91334d
-
91334d
---- glew/config/Makefile.linux.orig	2014-01-29 15:39:43.364972925 +0100
91334d
-+++ glew/config/Makefile.linux	2014-01-29 15:44:45.621000941 +0100
91334d
-@@ -1,6 +1,6 @@
91334d
- NAME = $(GLEW_NAME)
91334d
--CC = cc
91334d
--LD = cc
91334d
-+CC ?= cc
91334d
-+LD ?= $(CC)
91334d
- M_ARCH ?= $(shell uname -m)
91334d
- ARCH64 = false
91334d
- ifeq (x86_64,${M_ARCH})
91334d
---- glew/config/Makefile.darwin.orig	2014-01-29 15:44:39.541000377 +0100
91334d
-+++ glew/config/Makefile.darwin	2014-01-29 15:44:47.548001120 +0100
91334d
-@@ -1,6 +1,6 @@
91334d
- NAME = $(GLEW_NAME)
91334d
--CC = cc
91334d
--LD = cc
91334d
-+CC ?= cc
91334d
-+LD ?= $(CC)
91334d
- CFLAGS.EXTRA = -dynamic -fno-common
91334d
- #CFLAGS.EXTRA += -no-cpp-precomp
91334d
- LDFLAGS.EXTRA =
91334d
diff --git a/external/libgltf/ExternalProject_libgltf.mk b/external/libgltf/ExternalProject_libgltf.mk
91334d
index 57c01d0..90a1d96 100644
91334d
--- a/external/libgltf/ExternalProject_libgltf.mk
91334d
+++ b/external/libgltf/ExternalProject_libgltf.mk
91334d
@@ -17,7 +17,7 @@ $(eval $(call gb_ExternalProject_register_targets,libgltf,\
91334d
 
91334d
 $(eval $(call gb_ExternalProject_use_externals,libgltf,\
91334d
 	boost_headers \
91334d
-	glew \
91334d
+	epoxy \
91334d
 	glm_headers \
91334d
 ))
91334d
 
91334d
@@ -30,8 +30,8 @@ ifeq ($(SYSTEM_BOOST),)
91334d
 libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,boost)"
91334d
 endif
91334d
 
91334d
-ifeq ($(SYSTEM_GLEW),)
91334d
-libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,glew)/include"
91334d
+ifeq ($(SYSTEM_EPOXY),)
91334d
+libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,epoxy)/include"
91334d
 endif
91334d
 
91334d
 ifeq ($(SYSTEM_GLM),)
91334d
@@ -45,7 +45,7 @@ $(call gb_ExternalProject_get_state_target,libgltf,build) :
91334d
 			$(if $(filter 120,$(VCVER)),/p:PlatformToolset=v120 /p:VisualStudioVersion=12.0 /ToolsVersion:12.0) \
91334d
 			$(if $(filter 140,$(VCVER)),/p:PlatformToolset=v140 /p:VisualStudioVersion=14.0 /ToolsVersion:14.0) \
91334d
 			'/p:AdditionalIncludeDirectories=$(subst $(WHITESPACE),;,$(subst /,\,$(strip $(libgltf_AdditionalIncludes))))' \
91334d
-			/p:AdditionalLibraryDirectories=$(if $(SYSTEM_GLEW),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,glew))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \
91334d
+			/p:AdditionalLibraryDirectories=$(if $(SYSTEM_EPOXY),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,epoxy))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \
91334d
 	,build/win32)
91334d
 
91334d
 else # !ifeq($(COM),MSC)
91334d
@@ -67,7 +67,7 @@ $(call gb_ExternalProject_get_state_target,libgltf,build) :
91334d
 			$(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
91334d
 			--disable-werror \
91334d
 			BOOST_CFLAGS="$(BOOST_CPPFLAGS)" \
91334d
-			GLEW_CFLAGS="$(if $(SYSTEM_GLEW),$(GLEW_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glew)/include) -DGLEW_NO_GLU" \
91334d
+			EPOXY_CFLAGS="$(if $(SYSTEM_EPOXY),$(EPOXY_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,epoxy)/include)" \
91334d
 			GLM_CFLAGS="$(if $(SYSTEM_GLM),$(GLM_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glm))" \
91334d
 			$(if $(libgltf_CPPFLAGS),CPPFLAGS='$(libgltf_CPPFLAGS)') \
91334d
 		&& $(MAKE) \
91334d
diff --git a/external/libgltf/libgltf-msvc-x64.patch.1 b/external/libgltf/libgltf-msvc-x64.patch.1
91334d
index 86417a7..32a831b 100644
91334d
--- a/external/libgltf/libgltf-msvc-x64.patch.1
91334d
+++ b/external/libgltf/libgltf-msvc-x64.patch.1
91334d
@@ -20,7 +20,7 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
91334d
    </ItemGroup>
91334d
    <ItemGroup>
91334d
      <ClInclude Include="..\..\inc\libgltf.h" />
91334d
-@@ -56,6 +64,12 @@
91334d
+@@ -53,6 +61,12 @@
91334d
      <CharacterSet>MultiByte</CharacterSet>
91334d
      <PlatformToolset>v110</PlatformToolset>
91334d
    </PropertyGroup>
91334d
@@ -33,7 +33,7 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
91334d
    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
91334d
      <ConfigurationType>StaticLibrary</ConfigurationType>
91334d
      <UseDebugLibraries>false</UseDebugLibraries>
91334d
-@@ -63,15 +77,28 @@
91334d
+@@ -60,15 +74,28 @@
91334d
      <CharacterSet>MultiByte</CharacterSet>
91334d
      <PlatformToolset>v110</PlatformToolset>
91334d
    </PropertyGroup>
91334d
@@ -62,8 +62,8 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
91334d
    <PropertyGroup Label="UserMacros" />
91334d
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
91334d
      <ClCompile>
91334d
-@@ -86,6 +113,19 @@
91334d
-       <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
+@@ -83,10 +110,42 @@
91334d
+       <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
      </Link>
91334d
    </ItemDefinitionGroup>
91334d
 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
91334d
@@ -76,20 +76,13 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
91334d
 +    <Link>
91334d
 +      <GenerateDebugInformation>true</GenerateDebugInformation>
91334d
 +      <AdditionalLibraryDirectories>$(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
91334d
-+      <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
++      <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
 +    </Link>
91334d
 +  </ItemDefinitionGroup>
91334d
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
91334d
      <ClCompile>
91334d
        <WarningLevel>Level4</WarningLevel>
91334d
-@@ -105,6 +145,25 @@
91334d
-       <SubSystem>Windows</SubSystem>
91334d
-     </Link>
91334d
-   </ItemDefinitionGroup>
91334d
-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
91334d
-+    <ClCompile>
91334d
-+      <WarningLevel>Level4</WarningLevel>
91334d
-+      <Optimization>MaxSpeed</Optimization>
91334d
+       <Optimization>MaxSpeed</Optimization>
91334d
 +      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
91334d
 +      <FunctionLevelLinking>true</FunctionLevelLinking>
91334d
 +      <IntrinsicFunctions>true</IntrinsicFunctions>
91334d
@@ -101,10 +94,14 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
91334d
 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
91334d
 +      <OptimizeReferences>true</OptimizeReferences>
91334d
 +      <AdditionalLibraryDirectories>$(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
91334d
-+      <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
++      <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
91334d
 +      <SubSystem>Windows</SubSystem>
91334d
 +    </Link>
91334d
 +  </ItemDefinitionGroup>
91334d
-   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
91334d
-   <ImportGroup Label="ExtensionTargets">
91334d
-   </ImportGroup>
91334d
++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
91334d
++    <ClCompile>
91334d
++      <WarningLevel>Level4</WarningLevel>
91334d
++      <Optimization>MaxSpeed</Optimization>
91334d
+       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
91334d
+       <FunctionLevelLinking>true</FunctionLevelLinking>
91334d
+       <IntrinsicFunctions>true</IntrinsicFunctions>
91334d
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
91334d
index e3e9ce0..ffcd816 100644
91334d
--- a/include/vcl/opengl/OpenGLContext.hxx
91334d
+++ b/include/vcl/opengl/OpenGLContext.hxx
91334d
@@ -12,7 +12,7 @@
91334d
 
91334d
 #include <string.h>
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 
91334d
 #include <vcl/dllapi.h>
91334d
 #include <vcl/window.hxx>
91334d
@@ -158,8 +158,8 @@ private:
91334d
     virtual void destroyCurrentContext();
91334d
 
91334d
 protected:
91334d
-    bool InitGLEW();
91334d
-    static void InitGLEWDebugging();
91334d
+    bool InitGL();
91334d
+    static void InitGLDebugging();
91334d
     static void InitChildWindow(SystemChildWindow *pChildWindow);
91334d
     static void BuffersSwapped();
91334d
     virtual GLWindow& getModifiableOpenGLWindow() = 0;
91334d
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
91334d
index 458021f..23b9b79 100644
91334d
--- a/include/vcl/opengl/OpenGLHelper.hxx
91334d
+++ b/include/vcl/opengl/OpenGLHelper.hxx
91334d
@@ -10,7 +10,7 @@
91334d
 #ifndef INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
91334d
 #define INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 #include <sal/log.hxx>
91334d
 #include <vcl/dllapi.h>
91334d
 #include <vcl/bitmapex.hxx>
91334d
diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx
91334d
index 3b7f6a7..e9fb967 100644
91334d
--- a/include/vcl/opengl/OpenGLWrapper.hxx
91334d
+++ b/include/vcl/opengl/OpenGLWrapper.hxx
91334d
@@ -7,7 +7,7 @@
91334d
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
  */
91334d
 
91334d
-// Fully wrapped methods that have no exotic GL / GLEW header deps.
91334d
+// Fully wrapped methods that have no exotic GL header deps.
91334d
 
91334d
 #ifndef INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
91334d
 #define INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
91334d
diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk
91334d
index b908a0b..fb04596 100644
91334d
--- a/slideshow/Library_OGLTrans.mk
91334d
+++ b/slideshow/Library_OGLTrans.mk
91334d
@@ -34,7 +34,7 @@ $(eval $(call gb_Library_use_libraries,OGLTrans,\
91334d
 
91334d
 $(eval $(call gb_Library_use_externals,OGLTrans,\
91334d
 	boost_headers \
91334d
-	glew \
91334d
+	epoxy \
91334d
 	glm_headers \
91334d
 ))
91334d
 
91334d
@@ -56,13 +56,6 @@ $(eval $(call gb_Library_use_system_win32_libs,OGLTrans,\
91334d
     opengl32 \
91334d
 ))
91334d
 
91334d
-else
91334d
-
91334d
-$(eval $(call gb_Library_add_libs,OGLTrans,\
91334d
-	-lGL \
91334d
-	-lX11 \
91334d
-))
91334d
-
91334d
 endif
91334d
 
91334d
 $(eval $(call gb_Library_add_exception_objects,OGLTrans,\
91334d
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
91334d
index 3a9aac6..0583f5e 100644
91334d
--- a/slideshow/Library_slideshow.mk
91334d
+++ b/slideshow/Library_slideshow.mk
91334d
@@ -31,7 +31,7 @@ $(eval $(call gb_Library_use_externals,slideshow,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,slideshow,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
91334d
index 60ab587..115aaf2 100644
91334d
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
91334d
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
91334d
@@ -26,7 +26,6 @@
91334d
  *
91334d
  ************************************************************************/
91334d
 
91334d
-#include <GL/glew.h>
91334d
 #include <glm/gtc/matrix_transform.hpp>
91334d
 #include <glm/gtc/type_ptr.hpp>
91334d
 #include <vcl/opengl/OpenGLHelper.hxx>
91334d
diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx
91334d
index 66ecb6b..b739c0c 100644
91334d
--- a/slideshow/source/engine/opengl/TransitionImpl.hxx
91334d
+++ b/slideshow/source/engine/opengl/TransitionImpl.hxx
91334d
@@ -31,8 +31,7 @@
91334d
 #include <config_lgpl.h>
91334d
 #include <glm/gtc/type_ptr.hpp>
91334d
 
91334d
-#include <GL/glew.h>
91334d
-
91334d
+#include <limits>
91334d
 #include <memory>
91334d
 #include <vector>
91334d
 
91334d
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
91334d
index 61a28e9..1434b03 100644
91334d
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
91334d
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
91334d
@@ -830,7 +830,7 @@ void buildMipmaps(
91334d
     GLint internalFormat, GLsizei width, GLsizei height, GLenum format,
91334d
     GLenum type, const void * data)
91334d
 {
91334d
-    if (GLEW_ARB_framebuffer_object) {
91334d
+    if (epoxy_has_gl_extension("GL_ARB_framebuffer_object")) {
91334d
         glTexImage2D(
91334d
             GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type,
91334d
             data);
91334d
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
91334d
index 557c427..48ecf22 100644
91334d
--- a/svx/Library_svxcore.mk
91334d
+++ b/svx/Library_svxcore.mk
91334d
@@ -88,7 +88,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,svxcore,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
91334d
index 27bd721..b9a42d3 100644
91334d
--- a/toolkit/Library_tk.mk
91334d
+++ b/toolkit/Library_tk.mk
91334d
@@ -27,7 +27,7 @@ $(eval $(call gb_Library_use_externals,tk,\
91334d
 
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,tk,\
91334d
-    glew \
91334d
+    epoxy \
91334d
 ))
91334d
 endif
91334d
 $(eval $(call gb_Library_set_include,tk,\
91334d
diff --git a/vcl/CppunitTest_vcl_bitmap_test.mk b/vcl/CppunitTest_vcl_bitmap_test.mk
91334d
index 879c7ac..70ce156 100644
91334d
--- a/vcl/CppunitTest_vcl_bitmap_test.mk
91334d
+++ b/vcl/CppunitTest_vcl_bitmap_test.mk
91334d
@@ -19,7 +19,7 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_bitmap_test,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_CppunitTest_use_externals,vcl_bitmap_test,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/vcl/CppunitTest_vcl_wmf_test.mk
91334d
index 44d6851..3b78147 100644
91334d
--- a/vcl/CppunitTest_vcl_wmf_test.mk
91334d
+++ b/vcl/CppunitTest_vcl_wmf_test.mk
91334d
@@ -87,7 +87,7 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
@@ -136,7 +136,6 @@ $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
91334d
     -lm \
91334d
     -ldl \
91334d
     -lpthread \
91334d
-    -lGL \
91334d
     -lX11 \
91334d
 ))
91334d
 endif
91334d
@@ -189,7 +188,6 @@ ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
91334d
 $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
91334d
     -lm $(DLOPEN_LIBS) \
91334d
     -lpthread \
91334d
-    -lGL \
91334d
     -lX11 \
91334d
     -lXext \
91334d
 ))
91334d
diff --git a/vcl/Executable_icontest.mk b/vcl/Executable_icontest.mk
91334d
index 102697b..cce8feb 100644
91334d
--- a/vcl/Executable_icontest.mk
91334d
+++ b/vcl/Executable_icontest.mk
91334d
@@ -15,7 +15,7 @@ $(eval $(call gb_Executable_use_externals,icontest,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Executable_use_externals,icontest,\
91334d
-    glew \
91334d
+    epoxy \
91334d
 ))
91334d
 endif
91334d
 
91334d
diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk
91334d
index bff091e..a09d3b4 100644
91334d
--- a/vcl/Executable_vcldemo.mk
91334d
+++ b/vcl/Executable_vcldemo.mk
91334d
@@ -21,7 +21,7 @@ $(eval $(call gb_Executable_use_externals,vcldemo,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Executable_use_externals,vcldemo,\
91334d
-    glew \
91334d
+    epoxy \
91334d
 ))
91334d
 endif
91334d
 
91334d
diff --git a/vcl/Executable_visualbackendtest.mk b/vcl/Executable_visualbackendtest.mk
91334d
index abf8cbe..8704453 100644
91334d
--- a/vcl/Executable_visualbackendtest.mk
91334d
+++ b/vcl/Executable_visualbackendtest.mk
91334d
@@ -46,7 +46,6 @@ $(eval $(call gb_Executable_add_libs,visualbackendtest,\
91334d
 	-lm \
91334d
 	-ldl \
91334d
 	-lpthread \
91334d
-    -lGL \
91334d
     -lX11 \
91334d
 ))
91334d
 
91334d
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
91334d
index a52938b..a911329 100644
91334d
--- a/vcl/Library_vcl.mk
91334d
+++ b/vcl/Library_vcl.mk
91334d
@@ -124,7 +124,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
91334d
 ))
91334d
 ifeq ($(ENABLE_HEADLESS),)
91334d
 $(eval $(call gb_Library_use_externals,vcl,\
91334d
-     glew \
91334d
+     epoxy \
91334d
  ))
91334d
 endif
91334d
 
91334d
@@ -648,7 +648,6 @@ $(eval $(call gb_Library_add_libs,vcl,\
91334d
 	-lm \
91334d
 	-ldl \
91334d
 	-lpthread \
91334d
-    -lGL \
91334d
     -lX11 \
91334d
 ))
91334d
 endif
91334d
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
91334d
index f281605..0e1c39c 100644
91334d
--- a/vcl/Library_vclplug_gen.mk
91334d
+++ b/vcl/Library_vclplug_gen.mk
91334d
@@ -51,7 +51,7 @@ $(eval $(call gb_Library_use_externals,vclplug_gen,\
91334d
 	boost_headers \
91334d
 	cairo \
91334d
 	graphite \
91334d
-	glew \
91334d
+	epoxy \
91334d
 	glm_headers \
91334d
 	harfbuzz \
91334d
 	icu_headers \
91334d
@@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_libs,vclplug_gen,\
91334d
 	-lXext \
91334d
 	-lSM \
91334d
 	-lICE \
91334d
-	-lGL \
91334d
 ))
91334d
 
91334d
 $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
91334d
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
91334d
index c32a127..67247b7 100644
91334d
--- a/vcl/Library_vclplug_gtk.mk
91334d
+++ b/vcl/Library_vclplug_gtk.mk
91334d
@@ -59,7 +59,7 @@ $(eval $(call gb_Library_use_externals,vclplug_gtk,\
91334d
 	cairo \
91334d
 	dbus \
91334d
 	gio \
91334d
-	glew \
91334d
+	epoxy \
91334d
 	gtk \
91334d
 	gthread \
91334d
 	icuuc \
91334d
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
91334d
index 8d013d9..1457c1a 100644
91334d
--- a/vcl/Library_vclplug_gtk3.mk
91334d
+++ b/vcl/Library_vclplug_gtk3.mk
91334d
@@ -75,7 +75,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_gtk3,\
91334d
 
91334d
 $(eval $(call gb_Library_use_externals,vclplug_gtk3,\
91334d
 	boost_headers \
91334d
-	glew \
91334d
+	epoxy \
91334d
 	dbus \
91334d
 ))
91334d
 
91334d
diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk
91334d
index 30c4069..acd7bd5 100644
91334d
--- a/vcl/Library_vclplug_kde4.mk
91334d
+++ b/vcl/Library_vclplug_kde4.mk
91334d
@@ -54,7 +54,7 @@ $(eval $(call gb_Library_use_externals,vclplug_kde4,\
91334d
 	boost_headers \
91334d
 	icuuc \
91334d
 	kde4 \
91334d
-	glew \
91334d
+	epoxy \
91334d
 ))
91334d
 
91334d
 $(eval $(call gb_Library_add_libs,vclplug_kde4,\
91334d
diff --git a/vcl/inc/opengl/LineRenderUtils.hxx b/vcl/inc/opengl/LineRenderUtils.hxx
91334d
index 58ae6a8..e3f375b 100644
91334d
--- a/vcl/inc/opengl/LineRenderUtils.hxx
91334d
+++ b/vcl/inc/opengl/LineRenderUtils.hxx
91334d
@@ -11,7 +11,6 @@
91334d
 #ifndef INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H
91334d
 #define INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H
91334d
 
91334d
-#include <GL/glew.h>
91334d
 #include "opengl/VertexUtils.hxx"
91334d
 #include "opengl/RenderList.hxx"
91334d
 
91334d
diff --git a/vcl/inc/opengl/VertexUtils.hxx b/vcl/inc/opengl/VertexUtils.hxx
91334d
index f9804ec..de2c070 100644
91334d
--- a/vcl/inc/opengl/VertexUtils.hxx
91334d
+++ b/vcl/inc/opengl/VertexUtils.hxx
91334d
@@ -12,7 +12,7 @@
91334d
 #define INCLUDED_VCL_INC_OPENGL_VERTEXUTILS_H
91334d
 
91334d
 #include <basegfx/numeric/ftools.hxx>
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 #include <glm/gtx/norm.hpp>
91334d
 #include <vcl/salgtype.hxx>
91334d
 #include <vector>
91334d
diff --git a/vcl/inc/opengl/framebuffer.hxx b/vcl/inc/opengl/framebuffer.hxx
91334d
index ec7a450..a2dbd1e 100644
91334d
--- a/vcl/inc/opengl/framebuffer.hxx
91334d
+++ b/vcl/inc/opengl/framebuffer.hxx
91334d
@@ -10,7 +10,6 @@
91334d
 #ifndef INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H
91334d
 #define INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H
91334d
 
91334d
-#include <GL/glew.h>
91334d
 #include <vcl/dllapi.h>
91334d
 
91334d
 #include <opengl/texture.hxx>
91334d
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
91334d
index 73cdb7f..4632ddf 100644
91334d
--- a/vcl/inc/opengl/program.hxx
91334d
+++ b/vcl/inc/opengl/program.hxx
91334d
@@ -14,7 +14,6 @@
91334d
 
91334d
 #include <list>
91334d
 
91334d
-#include <GL/glew.h>
91334d
 #include <vcl/dllapi.h>
91334d
 
91334d
 #include <basegfx/point/b2dpoint.hxx>
91334d
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
91334d
index a0c8029..fd4eb97 100644
91334d
--- a/vcl/inc/opengl/texture.hxx
91334d
+++ b/vcl/inc/opengl/texture.hxx
91334d
@@ -20,7 +20,7 @@
91334d
 #ifndef INCLUDED_VCL_INC_OPENGL_TEXTURE_H
91334d
 #define INCLUDED_VCL_INC_OPENGL_TEXTURE_H
91334d
 
91334d
-#include <GL/glew.h>
91334d
+#include <epoxy/gl.h>
91334d
 #include <vcl/dllapi.h>
91334d
 #include <vcl/salgtype.hxx>
91334d
 #include <rtl/ustring.hxx>
91334d
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
91334d
index 6ef9e2a..a356ae8 100644
91334d
--- a/vcl/inc/pch/precompiled_vcl.hxx
91334d
+++ b/vcl/inc/pch/precompiled_vcl.hxx
91334d
@@ -56,6 +56,7 @@
91334d
 #include <boost/math/special_functions/sinc.hpp>
91334d
 #include <boost/multi_array.hpp>
91334d
 #include <boost/optional.hpp>
91334d
+#include <epoxy/gl.h>
91334d
 #include <osl/conditn.hxx>
91334d
 #include <osl/diagnose.h>
91334d
 #include <osl/diagnose.hxx>
91334d
@@ -184,7 +185,6 @@
91334d
 #include <vcl/virdev.hxx>
91334d
 #include <vcl/window.hxx>
91334d
 #include <vcl/wrkwin.hxx>
91334d
-#include <GL/glew.h>
91334d
 #include <PhysicalFontCollection.hxx>
91334d
 #include <PhysicalFontFace.hxx>
91334d
 #include <PhysicalFontFamily.hxx>
91334d
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
91334d
index 64998df..339ba80 100644
91334d
--- a/vcl/inc/unx/saldisp.hxx
91334d
+++ b/vcl/inc/unx/saldisp.hxx
91334d
@@ -28,7 +28,7 @@ class   SalXLib;
91334d
 #include <X11/Xlib.h>
91334d
 #include <X11/Xutil.h>
91334d
 #include <X11/extensions/Xrender.h>
91334d
-#include "GL/glxew.h"
91334d
+#include <epoxy/glx.h>
91334d
 
91334d
 #include <unx/salunx.h>
91334d
 #include <unx/saltype.h>
91334d
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
91334d
index b4f87a3..92dd18c 100644
91334d
--- a/vcl/opengl/x11/gdiimpl.cxx
91334d
+++ b/vcl/opengl/x11/gdiimpl.cxx
91334d
@@ -32,6 +32,7 @@
91334d
 #include <o3tl/lru_map.hxx>
91334d
 
91334d
 static std::vector<GLXContext> g_vShareList;
91334d
+static bool g_bAnyCurrent;
91334d
 
91334d
 class X11OpenGLContext : public OpenGLContext
91334d
 {
91334d
@@ -184,23 +185,10 @@ namespace
91334d
         return pFBC;
91334d
     }
91334d
 
91334d
-    // we need them before glew can initialize them
91334d
-    // glew needs an OpenGL context so we need to get the address manually
91334d
-    void initOpenGLFunctionPointers()
91334d
-    {
91334d
-        glXChooseFBConfig = reinterpret_cast<GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXChooseFBConfig")));
91334d
-        glXGetVisualFromFBConfig = reinterpret_cast<XVisualInfo*(*)(Display *dpy, GLXFBConfig config)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXGetVisualFromFBConfig")));    // try to find a visual for the current set of attributes
91334d
-        glXGetFBConfigAttrib = reinterpret_cast<int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXGetFBConfigAttrib")));
91334d
-        glXCreateContextAttribsARB = reinterpret_cast<GLXContext(*)(Display*, GLXFBConfig, GLXContext, Bool, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreateContextAttribsARB")));
91334d
-        glXCreatePixmap = reinterpret_cast<GLXPixmap(*)(Display*, GLXFBConfig, Pixmap, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreatePixmap")));
91334d
-    }
91334d
-
91334d
     Visual* getVisual(Display* dpy, Window win)
91334d
     {
91334d
         OpenGLZone aZone;
91334d
 
91334d
-        initOpenGLFunctionPointers();
91334d
-
91334d
         XWindowAttributes xattr;
91334d
         if( !XGetWindowAttributes( dpy, win, &xattr ) )
91334d
         {
91334d
@@ -235,7 +223,10 @@ void X11OpenGLContext::resetCurrent()
91334d
     OpenGLZone aZone;
91334d
 
91334d
     if (m_aGLWin.dpy)
91334d
+    {
91334d
         glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
91334d
+        g_bAnyCurrent = false;
91334d
+    }
91334d
 }
91334d
 
91334d
 bool X11OpenGLContext::isCurrent()
91334d
@@ -247,7 +238,7 @@ bool X11OpenGLContext::isCurrent()
91334d
 
91334d
 bool X11OpenGLContext::isAnyCurrent()
91334d
 {
91334d
-    return glXGetCurrentContext() != None;
91334d
+    return g_bAnyCurrent && glXGetCurrentContext() != None;
91334d
 }
91334d
 
91334d
 SystemWindowData X11OpenGLContext::generateWinData(vcl::Window* pParent, bool /*bRequestLegacyContext*/)
91334d
@@ -266,8 +257,6 @@ SystemWindowData X11OpenGLContext::generateWinData(vcl::Window* pParent, bool /*
91334d
     if( dpy == nullptr || !glXQueryExtension( dpy, nullptr, nullptr ) )
91334d
         return aWinData;
91334d
 
91334d
-    initOpenGLFunctionPointers();
91334d
-
91334d
     int best_fbc = -1;
91334d
     GLXFBConfig* pFBC = getFBConfig(dpy, win, best_fbc, true, false);
91334d
 
91334d
@@ -355,10 +344,13 @@ bool X11OpenGLContext::ImplInit()
91334d
 
91334d
     if( !glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ) )
91334d
     {
91334d
+        g_bAnyCurrent = false;
91334d
         SAL_WARN("vcl.opengl", "unable to select current GLX context");
91334d
         return false;
91334d
     }
91334d
 
91334d
+    g_bAnyCurrent = true;
91334d
+
91334d
     int glxMinor, glxMajor;
91334d
     double nGLXVersion = 0;
91334d
     if( glXQueryVersion( m_aGLWin.dpy, &glxMajor, &glxMinor ) )
91334d
@@ -400,8 +392,8 @@ bool X11OpenGLContext::ImplInit()
91334d
         }
91334d
     }
91334d
 
91334d
-    bool bRet = InitGLEW();
91334d
-    InitGLEWDebugging();
91334d
+    bool bRet = InitGL();
91334d
+    InitGLDebugging();
91334d
 
91334d
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
91334d
 
91334d
@@ -427,10 +419,12 @@ void X11OpenGLContext::makeCurrent()
91334d
     {
91334d
         if (!glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ))
91334d
         {
91334d
+            g_bAnyCurrent = false;
91334d
             SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed "
91334d
                      "on drawable " << m_aGLWin.win);
91334d
             return;
91334d
         }
91334d
+        g_bAnyCurrent = true;
91334d
     }
91334d
 
91334d
     registerAsCurrent();
91334d
@@ -445,6 +439,7 @@ void X11OpenGLContext::destroyCurrentContext()
91334d
             g_vShareList.erase(itr);
91334d
 
91334d
         glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
91334d
+        g_bAnyCurrent = false;
91334d
         if( glGetError() != GL_NO_ERROR )
91334d
         {
91334d
             SAL_WARN("vcl.opengl", "glError: " << glGetError());
91334d
diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx
91334d
index c75f2a7..9e6e746 100644
91334d
--- a/vcl/osx/salobj.cxx
91334d
+++ b/vcl/osx/salobj.cxx
91334d
@@ -321,8 +321,8 @@ bool AquaOpenGLContext::ImplInit()
91334d
     NSOpenGLView* pView = getOpenGLView();
91334d
     [[pView openGLContext] makeCurrentContext];
91334d
 
91334d
-    bool bRet = InitGLEW();
91334d
-    InitGLEWDebugging();
91334d
+    bool bRet = InitGL();
91334d
+    InitGLDebugging();
91334d
     return bRet;
91334d
 }
91334d
 
91334d
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
91334d
index fc12d88..11a0052 100644
91334d
--- a/vcl/source/opengl/OpenGLContext.cxx
91334d
+++ b/vcl/source/opengl/OpenGLContext.cxx
91334d
@@ -7,7 +7,6 @@
91334d
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
91334d
  */
91334d
 
91334d
-#include <config_opengl.h>
91334d
 #include <chrono>
91334d
 
91334d
 #include <vcl/opengl/OpenGLContext.hxx>
91334d
@@ -205,13 +204,8 @@ extern "C" void
91334d
 APIENTRY
91334d
 #endif
91334d
 debug_callback(GLenum source, GLenum type, GLuint id,
91334d
-        GLenum severity, GLsizei , const GLchar* message,
91334d
-#if HAVE_GLEW_1_12
91334d
-        const GLvoid*
91334d
-#else
91334d
-        GLvoid*
91334d
-#endif
91334d
-        )
91334d
+               GLenum severity, GLsizei , const GLchar* message,
91334d
+               const GLvoid*)
91334d
 {
91334d
     // ignore Nvidia's 131218: "Program/shader state performance warning: Fragment Shader is going to be recompiled because the shader key based on GL state mismatches."
91334d
     // the GLSL compiler is a bit too aggressive in optimizing the state based on the current OpenGL state
91334d
@@ -281,30 +275,14 @@ OUString getGLString(GLenum eGlEnum)
91334d
     return sString;
91334d
 }
91334d
 
91334d
-bool OpenGLContext::InitGLEW()
91334d
+bool OpenGLContext::InitGL()
91334d
 {
91334d
-    static bool bGlewInit = false;
91334d
-    if(!bGlewInit)
91334d
-    {
91334d
-        OpenGLZone aZone;
91334d
-
91334d
-        glewExperimental = GL_TRUE;
91334d
-        GLenum err = glewInit();
91334d
-        if (err != GLEW_OK)
91334d
-        {
91334d
-            SAL_WARN("vcl.opengl", "Failed to initialize GLEW: " << glewGetErrorString(err));
91334d
-            return false;
91334d
-        }
91334d
-        else
91334d
-            bGlewInit = true;
91334d
-    }
91334d
-
91334d
     VCL_GL_INFO("OpenGLContext::ImplInit----end");
91334d
     VCL_GL_INFO("Vendor: " << getGLString(GL_VENDOR) << " Renderer: " << getGLString(GL_RENDERER) << " GL version: " << OpenGLHelper::getGLVersion());
91334d
     mbInitialized = true;
91334d
 
91334d
     // I think we need at least GL 3.0
91334d
-    if (!GLEW_VERSION_3_0)
91334d
+    if (epoxy_gl_version() < 30)
91334d
     {
91334d
         SAL_WARN("vcl.opengl", "We don't have at least OpenGL 3.0");
91334d
         return false;
91334d
@@ -320,11 +298,11 @@ bool OpenGLContext::InitGLEW()
91334d
     return true;
91334d
 }
91334d
 
91334d
-void OpenGLContext::InitGLEWDebugging()
91334d
+void OpenGLContext::InitGLDebugging()
91334d
 {
91334d
 #ifdef DBG_UTIL
91334d
     // only enable debug output in dbgutil build
91334d
-    if( GLEW_ARB_debug_output)
91334d
+    if (epoxy_has_gl_extension("GL_ARB_debug_output"))
91334d
     {
91334d
         OpenGLZone aZone;
91334d
 
91334d
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
91334d
index e00a93a..6f4a880 100644
91334d
--- a/vcl/source/opengl/OpenGLHelper.cxx
91334d
+++ b/vcl/source/opengl/OpenGLHelper.cxx
91334d
@@ -401,7 +401,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
91334d
         aGeometryShaderSource = getShaderSource(rGeometryShaderName);
91334d
 
91334d
     GLint bBinaryResult = GL_FALSE;
91334d
-    if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() )
91334d
+    if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty())
91334d
     {
91334d
         OString aFileName =
91334d
                 createFileName(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, rDigest);
91334d
@@ -473,7 +473,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
91334d
     if (bHasGeometryShader)
91334d
         glAttachShader(ProgramID, GeometryShaderID);
91334d
 
91334d
-    if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() )
91334d
+    if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty())
91334d
     {
91334d
         glProgramParameteri(ProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
91334d
         glLinkProgram(ProgramID);
91334d
@@ -1106,14 +1106,14 @@ void OpenGLHelper::debugMsgPrint(const int nType, const char *pFormat, ...)
91334d
     {
91334d
         OpenGLZone aZone;
91334d
 
91334d
-        if (GLEW_KHR_debug)
91334d
+        if (epoxy_has_gl_extension("GL_KHR_debug"))
91334d
             glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION,
91334d
                                  GL_DEBUG_TYPE_OTHER,
91334d
                                  1, // one[sic] id is as good as another ?
91334d
                                  // GL_DEBUG_SEVERITY_NOTIFICATION for >= GL4.3 ?
91334d
                                  GL_DEBUG_SEVERITY_LOW,
91334d
                                  strlen(pStr), pStr);
91334d
-        else if (GLEW_AMD_debug_output)
91334d
+        else if (epoxy_has_gl_extension("GL_AMD_debug_output"))
91334d
             glDebugMessageInsertAMD(GL_DEBUG_CATEGORY_APPLICATION_AMD,
91334d
                                     GL_DEBUG_SEVERITY_LOW_AMD,
91334d
                                     1, // one[sic] id is as good as another ?
91334d
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
91334d
index 0bff9b8..34f0e6f 100644
91334d
--- a/vcl/unx/generic/app/saldisp.cxx
91334d
+++ b/vcl/unx/generic/app/saldisp.cxx
91334d
@@ -47,7 +47,6 @@
91334d
 #include <X11/extensions/Xinerama.h>
91334d
 #endif
91334d
 
91334d
-#include "GL/glxew.h"
91334d
 #include <opengl/zone.hxx>
91334d
 
91334d
 #include <vcl/svapp.hxx>
91334d
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
91334d
index ae2973b..32d6ae8 100644
91334d
--- a/vcl/workben/icontest.cxx
91334d
+++ b/vcl/workben/icontest.cxx
91334d
@@ -20,8 +20,6 @@
91334d
 
91334d
 #include <math.h>
91334d
 
91334d
-#include <GL/glew.h>
91334d
-
91334d
 #include <glm/gtx/bit.hpp>
91334d
 
91334d
 #include <com/sun/star/lang/XComponent.hpp>
91334d
-- 
91334d
2.13.0
91334d