[libreoffice] 02/03: update gtk3-opengl-slideshow.diff; add glew->epoxy change from master

Rene Engelhard rene at moszumanska.debian.org
Sun Dec 18 20:13:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

rene pushed a commit to branch debian-experimental-5.3
in repository libreoffice.

commit 79c36302330d0e13d00e27b880a9102f565a44ef
Author: Rene Engelhard <rene at debian.org>
Date:   Sun Dec 18 21:04:28 2016 +0100

    update gtk3-opengl-slideshow.diff; add glew->epoxy change from master
---
 changelog                              |   15 +-
 control                                |    4 +-
 patches/change-from-glew-to-epoxy.diff | 2244 ++++++++++++++++++++++++++++++++
 patches/gtk3-opengl-slideshow.diff     |  190 +--
 patches/series                         |    1 +
 rules                                  |   23 +-
 shlibs.override.glew                   |    1 -
 tests/control                          |    2 +-
 8 files changed, 2324 insertions(+), 156 deletions(-)

diff --git a/changelog b/changelog
index 85683e2..851e998 100644
--- a/changelog
+++ b/changelog
@@ -2,15 +2,20 @@ libreoffice (1:5.3.0~rc1~git20161218-1) UNRELEASED; urgency=medium
 
   * New upstream snapshot
 
-  * debian/patches/gtk3-opengl-slideshow.diff: add Fedora 25 patches
-    backported from master to rework Diamond slide transition to use only
-    OpenGL core (all we have in gtk3) and fix ogltrans generically with gtk3
-    (without the glew->epoxy move)
+  * debian/patches/change-from-glew-to-epoxy.diff: backport from master;
+    as name says
+  * debian/patches/gtk3-opengl-slideshow.diff: backport from master to fix
+    ogltrans generically with gtk3
 
   * debian/control.ogltrans.in:
     - add Conflicts: libreoffice-gtk3 (<< 1:5.2.4~rc2)
 
- -- Rene Engelhard <rene at debian.org>  Sun, 11 Dec 2016 13:31:35 +0100
+  * debian/rules:
+    - change glew conditionals/build-deps to epoxy
+    - temporarily use internal libgltf until libgltf 0.1.0 (using epoxy)
+      is out of NEW...
+
+ -- Rene Engelhard <rene at debian.org>  Sun, 11 Dec 2016 13:35:52 +0100
 
 libreoffice (1:5.3.0~beta2-1) experimental; urgency=medium
 
diff --git a/control b/control
index 7a2c3ec..22d6203 100644
--- a/control
+++ b/control
@@ -61,6 +61,7 @@ Build-Depends: ant (>= 1.7.0) [!hppa !ia64 !mips64 !s390 !sparc],
                libe-book-dev,
                libebook1.2-dev,
                libeot-dev,
+               libepoxy-dev (>= 1.3.1),
                libetonyek-dev,
                libexpat1-dev,
                libexttextcat-dev (>= 3.4.1),
@@ -68,11 +69,8 @@ Build-Depends: ant (>= 1.7.0) [!hppa !ia64 !mips64 !s390 !sparc],
                libfreehand-dev (>= 0.1),
                libfreetype6-dev (>= 2.2.0),
                libgirepository1.0-dev (>= 1.32),
-               libgl1-mesa-dev,
-               libglew-dev,
                libglib2.0-dev (>= 2.15.0),
                libglm-dev (>= 0.9.6.3),
-               libgltf-dev (>= 0.0.2-4),
                libgraphite2-dev (>= 0.9.3),
                libgstreamer-plugins-base1.0-dev,
                libgstreamer1.0-dev,
diff --git a/patches/change-from-glew-to-epoxy.diff b/patches/change-from-glew-to-epoxy.diff
new file mode 100644
index 0000000..8e99398
--- /dev/null
+++ b/patches/change-from-glew-to-epoxy.diff
@@ -0,0 +1,2244 @@
+From 482d7ce61b423600b41b459eb26a2cc221cd0acf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Fri, 25 Nov 2016 20:25:27 +0000
+Subject: change from glew to epoxy
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+because that works under wayland out of the box and gtk3 uses it already
+
+Change-Id: Iefaac31e325534a81a5389f752804af917c1baef
+Reviewed-on: https://gerrit.libreoffice.org/31213
+Tested-by: Jenkins <ci at libreoffice.org>
+Reviewed-by: Caolán McNamara <caolanm at redhat.com>
+Tested-by: Caolán McNamara <caolanm at redhat.com>
+
+diff --git a/Makefile.fetch b/Makefile.fetch
+index 3e21be3..cf31e5b 100644
+--- a/Makefile.fetch
++++ b/Makefile.fetch
+@@ -129,7 +129,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
+ 		$(call fetch_Optional,FONTCONFIG,FONTCONFIG_TARBALL) \
+ 		$(call fetch_Optional,FREEHAND,FREEHAND_TARBALL) \
+ 		$(call fetch_Optional,FREETYPE,FREETYPE_TARBALL) \
+-		$(call fetch_Optional,GLEW,GLEW_TARBALL) \
++		$(call fetch_Optional,EPOXY,EPOXY_TARBALL) \
+ 		$(call fetch_Optional,GLM,GLM_TARBALL) \
+ 		$(call fetch_Optional_pack,GOOGLE_DOCS_EXTENSION_PACK) \
+ 		$(call fetch_Optional,GRAPHITE,GRAPHITE_TARBALL) \
+diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
+index fd6f4c8..dcc47a6 100644
+--- a/RepositoryExternal.mk
++++ b/RepositoryExternal.mk
+@@ -183,51 +183,43 @@ endef
+ 
+ endif # SYSTEM_CPPUNIT
+ 
+-ifneq ($(SYSTEM_GLEW),)
++ifneq ($(SYSTEM_EPOXY),)
+ 
+-define gb_LinkTarget__use_glew
++define gb_LinkTarget__use_epoxy
+ $(call gb_LinkTarget_set_include,$(1),\
+ 	$$(INCLUDE) \
+-    $(GLEW_CFLAGS) \
++    $(EPOXY_CFLAGS) \
+ )
+-$(call gb_LinkTarget_add_libs,$(1),$(GLEW_LIBS))
++$(call gb_LinkTarget_add_libs,$(1),$(EPOXY_LIBS))
+ 
+ endef
+ 
+-gb_ExternalProject__use_glew :=
++gb_ExternalProject__use_epoxy :=
+ 
+-else # !SYSTEM_GLEW
++else # !SYSTEM_EPOXY
+ 
+-$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+-	glew \
+-))
+-
+-define gb_LinkTarget__use_glew
+-$(call gb_LinkTarget_use_package,$(1),glew)
++define gb_LinkTarget__use_epoxy
+ $(call gb_LinkTarget_set_include,$(1),\
+-	-I$(call gb_UnpackedTarball_get_dir,glew/include) \
+-	-DGLEW_NO_GLU \
+-	$$(INCLUDE) \
++       -I$(call gb_UnpackedTarball_get_dir,epoxy/include) \
++       $$(INCLUDE) \
+ )
+ 
+-ifeq ($(COM),MSC)
+-$(call gb_LinkTarget_add_libs,$(1),\
+-	$(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) \
+-)
+-else
+-$(call gb_LinkTarget_add_libs,$(1),\
+-	-L$(call gb_UnpackedTarball_get_dir,glew)/lib/ -lGLEW \
++$(call gb_LinkTarget_use_libraries,$(1),\
++    epoxy \
+ )
+-endif
+ 
+ endef
+ 
+-define gb_ExternalProject__use_glew
+-$(call gb_ExternalProject_use_external_project,$(1),glew)
++$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo,\
++	epoxy \
++))
++
++define gb_ExternalProject__use_epoxy
++$(call gb_ExternalProject_use_external_project,$(1),epoxy)
+ 
+ endef
+ 
+-endif # SYSTEM_GLEW
++endif # SYSTEM_EPOXY
+ 
+ define gb_LinkTarget__use_iconv
+ $(call gb_LinkTarget_add_libs,$(1),-liconv)
+@@ -3435,7 +3427,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
+ )
+ else
+ $(call gb_LinkTarget_add_libs,$(1),\
+-	$(call gb_UnpackedTarball_get_dir,libgltf)/src/.libs/libgltf-0.0$(gb_StaticLibrary_PLAINEXT) \
++	$(call gb_UnpackedTarball_get_dir,libgltf)/src/.libs/libgltf-0.1$(gb_StaticLibrary_PLAINEXT) \
+ )
+ endif
+ 
+diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
+index 4e8f3b1..e662fc3 100644
+--- a/avmedia/Library_avmedia.mk
++++ b/avmedia/Library_avmedia.mk
+@@ -29,7 +29,7 @@ $(eval $(call gb_Library_use_externals,avmedia,\
+ 
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,avmedia,\
+-    glew \
++    epoxy \
+ ))
+ endif
+ 
+diff --git a/avmedia/Library_avmediaogl.mk b/avmedia/Library_avmediaogl.mk
+index b7498bf..191fb75 100644
+--- a/avmedia/Library_avmediaogl.mk
++++ b/avmedia/Library_avmediaogl.mk
+@@ -16,7 +16,7 @@ $(eval $(call gb_Library_use_sdk_api,avmediaogl))
+ $(eval $(call gb_Library_use_externals,avmediaogl, \
+     boost_headers \
+     libgltf \
+-    glew \
++    epoxy \
+     glm_headers \
+ ))
+ 
+@@ -51,10 +51,6 @@ else ifeq ($(OS),MACOSX)
+ $(eval $(call gb_Library_use_system_darwin_frameworks,avmediaogl,\
+ 	OpenGL \
+ ))
+-else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
+-$(eval $(call gb_Library_add_libs,avmediaogl,\
+-    -lGL \
+-))
+ endif
+ 
+ # vim: set noet sw=4 ts=4:
+diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
+index d22bc49..298f81e 100755
+--- a/bin/check-elf-dynamic-objects
++++ b/bin/check-elf-dynamic-objects
+@@ -105,7 +105,7 @@ local file="$1"
+         */libdesktop_detectorlo.so|*/ui-previewer|*/oosplash|*/gengal.bin)
+             whitelist="${whitelist} ${x11whitelist}"
+         ;;
+-        */libvclplug_genlo.so|*/libGLEW.so.*|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
++        */libvclplug_genlo.so|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
+             whitelist="${whitelist} ${x11whitelist} ${openglwhitelist}"
+         ;;
+         */libvcllo.so|*/libsofficeapp.so)
+diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs
+index 813241e..9faa042 100755
+--- a/bin/lo-all-static-libs
++++ b/bin/lo-all-static-libs
+@@ -63,7 +63,7 @@ echo $INSTDIR/$LIBO_LIB_FOLDER/lib*.a \
+      $WORKDIR/UnpackedTarball/coinmp/CoinMP/src/.libs/*.a \
+      $WORKDIR/UnpackedTarball/coinmp/CoinUtils/src/.libs/*.a \
+      $WORKDIR/UnpackedTarball/coinmp/Osi/src/Osi/.libs/*.a \
+-     $WORKDIR/UnpackedTarball/glew/lib/*.a \
++     $WORKDIR/UnpackedTarball/epoxy/lib/*.a \
+      $WORKDIR/UnpackedTarball/icu/source/lib/*.a \
+      $WORKDIR/UnpackedTarball/langtag/liblangtag/.libs/*.a \
+      $WORKDIR/UnpackedTarball/lcms2/src/.libs/*.a \
+diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
+index 0118eb1..9d1042d 100644
+--- a/canvas/Library_oglcanvas.mk
++++ b/canvas/Library_oglcanvas.mk
+@@ -42,7 +42,7 @@ $(eval $(call gb_Library_add_exception_objects,oglcanvas,\
+ 
+ $(eval $(call gb_Library_use_externals,oglcanvas,\
+ 	boost_headers \
+-	glew \
++	epoxy \
+ ))
+ 
+ ifeq ($(strip $(OS)),MACOSX)
+@@ -58,11 +58,6 @@ $(eval $(call gb_Library_use_system_win32_libs,oglcanvas,\
+     opengl32 \
+ ))
+ 
+-else
+-$(eval $(call gb_Library_add_libs,oglcanvas,\
+-    -lGL \
+-    -lX11 \
+-))
+ endif
+ 
+ # vim: set noet sw=4 ts=4:
+diff --git a/canvas/source/opengl/ogl_buffercontext.hxx b/canvas/source/opengl/ogl_buffercontext.hxx
+index 202e063..7f2066a 100644
+--- a/canvas/source/opengl/ogl_buffercontext.hxx
++++ b/canvas/source/opengl/ogl_buffercontext.hxx
+@@ -10,7 +10,7 @@
+ #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BUFFERCONTEXT_HXX
+ #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BUFFERCONTEXT_HXX
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <sal/config.h>
+ #include <memory>
+diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
+index 8d38177..6b23d45 100644
+--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
++++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
+@@ -9,7 +9,7 @@
+ 
+ #include <sal/config.h>
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <basegfx/matrix/b2dhommatrix.hxx>
+ #include <basegfx/point/b2dpoint.hxx>
+diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
+index 84a96ce..175a02b 100644
+--- a/canvas/source/opengl/ogl_canvashelper.cxx
++++ b/canvas/source/opengl/ogl_canvashelper.cxx
+@@ -11,7 +11,7 @@
+ 
+ #include <memory>
+ #include <functional>
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <basegfx/polygon/b2dpolygontriangulator.hxx>
+ #include <basegfx/polygon/b2dpolypolygon.hxx>
+diff --git a/canvas/source/opengl/ogl_canvastools.cxx b/canvas/source/opengl/ogl_canvastools.cxx
+index 657a220..3d9448b 100644
+--- a/canvas/source/opengl/ogl_canvastools.cxx
++++ b/canvas/source/opengl/ogl_canvastools.cxx
+@@ -9,7 +9,7 @@
+ 
+ #include <sal/config.h>
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <basegfx/matrix/b2dhommatrix.hxx>
+ #include <basegfx/polygon/b2dpolygontriangulator.hxx>
+diff --git a/canvas/source/opengl/ogl_texturecache.cxx b/canvas/source/opengl/ogl_texturecache.cxx
+index 08cdd2f..43fb7d8 100644
+--- a/canvas/source/opengl/ogl_texturecache.cxx
++++ b/canvas/source/opengl/ogl_texturecache.cxx
+@@ -9,7 +9,7 @@
+ 
+ #include <sal/config.h>
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <com/sun/star/geometry/IntegerSize2D.hpp>
+ 
+diff --git a/canvas/source/opengl/ogl_tools.hxx b/canvas/source/opengl/ogl_tools.hxx
+index 8133212..469a5be 100644
+--- a/canvas/source/opengl/ogl_tools.hxx
++++ b/canvas/source/opengl/ogl_tools.hxx
+@@ -11,8 +11,7 @@
+ #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_TOOLS_HXX
+ 
+ #include <sal/config.h>
+-#include <GL/glew.h>
+-
++#include <epoxy/gl.h>
+ 
+ namespace oglcanvas
+ {
+diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
+index b15f634..cc06fbd 100644
+--- a/chart2/Library_chartcore.mk
++++ b/chart2/Library_chartcore.mk
+@@ -32,7 +32,7 @@ $(eval $(call gb_Library_use_externals,chartcore,\
+ 
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,chartcore,\
+-    glew \
++    epoxy \
+ ))
+ endif
+ 
+@@ -264,13 +264,6 @@ else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
+ $(eval $(call gb_Library_add_libs,chartcore,\
+ 	$(DLOPEN_LIBS) \
+ ))
+-ifeq ($(ENABLE_HEADLESS),)
+-$(eval $(call gb_Library_add_libs,chartcore,\
+-    -lGL \
+-    -lX11 \
+-))
+-endif #!ENABLE_HEADLESS
+-
+ endif
+ 
+ # vim: set noet sw=4 ts=4:
+diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk
+index 95ea58d..53056aa 100644
+--- a/chart2/Library_chartopengl.mk
++++ b/chart2/Library_chartopengl.mk
+@@ -22,7 +22,7 @@ $(eval $(call gb_Library_set_precompiled_header,chartopengl,$(SRCDIR)/chart2/inc
+ $(eval $(call gb_Library_use_externals,chartopengl,\
+ 	boost_headers \
+ 	glm_headers \
+-	glew \
++	epoxy \
+ ))
+ 
+ $(eval $(call gb_Library_use_sdk_api,chartopengl))
+@@ -68,8 +68,6 @@ $(eval $(call gb_Library_use_system_darwin_frameworks,chartopengl,\
+ else ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
+ $(eval $(call gb_Library_add_libs,chartopengl,\
+ 	$(DLOPEN_LIBS) \
+-	-lGL \
+-	-lX11 \
+ ))
+ endif
+  
+diff --git a/chart2/inc/pch/precompiled_chartcore.hxx b/chart2/inc/pch/precompiled_chartcore.hxx
+index 8d02451..908d7ac 100644
+--- a/chart2/inc/pch/precompiled_chartcore.hxx
++++ b/chart2/inc/pch/precompiled_chartcore.hxx
+@@ -73,7 +73,6 @@
+ #include <vcl/virdev.hxx>
+ #include <vcl/wall.hxx>
+ #include <ChartModel.hxx>
+-#include <GL/glew.h>
+ #include <basegfx/basegfxdllapi.h>
+ #include <basegfx/matrix/b3dhommatrix.hxx>
+ #include <basegfx/numeric/ftools.hxx>
+@@ -169,6 +168,7 @@
+ #include <cppuhelper/weak.hxx>
+ #include <editeng/editengdllapi.h>
+ #include <editeng/unoprnms.hxx>
++#include <epoxy/gl.h>
+ #include <i18nlangtag/i18nlangtagdllapi.h>
+ #include <i18nlangtag/lang.h>
+ #include <i18nlangtag/languagetag.hxx>
+diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
+index a4193da..401b664 100644
+--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
++++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
+@@ -9,7 +9,7 @@
+ 
+ #include <GL3DBarChart.hxx>
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <glm/glm.hpp>
+ #include <glm/gtx/transform.hpp>
+diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
+index fb4fb13..e1e4c01 100644
+--- a/chart2/source/view/main/GL3DRenderer.cxx
++++ b/chart2/source/view/main/GL3DRenderer.cxx
+@@ -7,7 +7,7 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include "GL3DRenderer.hxx"
+ 
+@@ -244,8 +244,8 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
+         m_3DBatchNormalID = glGetAttribLocation(m_3DBatchProID, "vertexNormalModelspace");
+         m_3DBatchColorID = glGetAttribLocation(m_3DBatchProID, "barColor");
+ #if !defined MACOSX
+-        //check whether the texture array is support
+-        mbTexBatchSupport = GLEW_EXT_texture_array;
++        //check whether the texture array is supported
++        mbTexBatchSupport = epoxy_has_gl_extension("GL_EXT_texture_array");
+ #endif
+         CHECK_GL_ERROR();
+         if (mbTexBatchSupport)
+@@ -401,7 +401,7 @@ void OpenGL3DRenderer::init()
+     m_fViewAngle = 30.0f;
+     m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 6000.0f);
+ 
+-    maResources.m_b330Support = GLEW_VERSION_3_3;
++    maResources.m_b330Support = epoxy_gl_version() >= 33;
+     CHECK_GL_ERROR();
+     maResources.LoadShaders();
+     maPickingResources.LoadShaders();
+diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
+index 3182e66..91a3763 100644
+--- a/chart2/source/view/main/OpenGLRender.cxx
++++ b/chart2/source/view/main/OpenGLRender.cxx
+@@ -7,7 +7,7 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ #include <vector>
+ #include "OpenGLRender.hxx"
+ #include <vcl/graph.hxx>
+diff --git a/config_host.mk.in b/config_host.mk.in
+index 1abb21e..7b3197e 100644
+--- a/config_host.mk.in
++++ b/config_host.mk.in
+@@ -199,8 +199,8 @@ export GIO_LIBS=$(gb_SPACE)@GIO_LIBS@
+ export GIT_REFERENCE_SRC=@GIT_REFERENCE_SRC@
+ export GIT_LINK_SRC=@GIT_LINK_SRC@
+ export GIT_NEEDED_SUBMODULES=@GIT_NEEDED_SUBMODULES@
+-export GLEW_CFLAGS=$(gb_SPACE)@GLEW_CFLAGS@
+-export GLEW_LIBS=$(gb_SPACE)@GLEW_LIBS@
++export EPOXY_CFLAGS=$(gb_SPACE)@EPOXY_CFLAGS@
++export EPOXY_LIBS=$(gb_SPACE)@EPOXY_LIBS@
+ export GLM_CFLAGS=$(gb_SPACE)@GLM_CFLAGS@
+ export GNOMEVFS_CFLAGS=$(gb_SPACE)@GNOMEVFS_CFLAGS@
+ export GNOMEVFS_LIBS=$(gb_SPACE)@GNOMEVFS_LIBS@
+@@ -513,7 +513,7 @@ export SYSTEM_FIREBIRD=@SYSTEM_FIREBIRD@
+ export SYSTEM_GENBRK=@SYSTEM_GENBRK@
+ export SYSTEM_GENCCODE=@SYSTEM_GENCCODE@
+ export SYSTEM_GENCMN=@SYSTEM_GENCMN@
+-export SYSTEM_GLEW=@SYSTEM_GLEW@
++export SYSTEM_EPOXY=@SYSTEM_EPOXY@
+ export SYSTEM_GLM=@SYSTEM_GLM@
+ export SYSTEM_GRAPHITE=@SYSTEM_GRAPHITE@
+ export SYSTEM_HARFBUZZ=@SYSTEM_HARFBUZZ@
+diff --git a/config_host/config_opengl.h.in b/config_host/config_opengl.h.in
+deleted file mode 100644
+index 67b9e47..0000000
+--- a/config_host/config_opengl.h.in
++++ /dev/null
+@@ -1,10 +0,0 @@
+-/*
+-Settings for OpenGL
+-*/
+-
+-#ifndef CONFIG_OPENGL_H
+-#define CONFIG_OPENGL_H
+-
+-#define HAVE_GLEW_1_12 0
+-
+-#endif
+diff --git a/configure.ac b/configure.ac
+index 4a0dac7..18815ad 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1627,6 +1627,11 @@ AC_ARG_WITH(system-cairo,
+         [Use cairo libraries already on system.  Happens automatically for
+          (implicit) --enable-gtk and for --enable-gtk3.]))
+ 
++AC_ARG_WITH(system-epoxy,
++    AS_HELP_STRING([--with-system-epoxy],
++        [Use epoxy libraries already on system.  Happens automatically for
++         --enable-gtk3.]))
++
+ AC_ARG_WITH(myspell-dicts,
+     AS_HELP_STRING([--with-myspell-dicts],
+         [Adds myspell dictionaries to the LibreOffice installation set]),
+@@ -8921,14 +8926,6 @@ AC_SUBST([GLM_CFLAGS])
+ AC_SUBST([SYSTEM_GLM])
+ 
+ dnl ===================================================================
+-dnl Check for system glew
+-dnl ===================================================================
+-libo_CHECK_SYSTEM_MODULE([glew], [GLEW], [glew >= 1.10.0])
+-AS_IF([test "$with_system_glew" = "yes"],
+-    [PKG_CHECK_EXISTS([glew >= 1.12.0], [AC_DEFINE([HAVE_GLEW_1_12])])],
+-    [AC_DEFINE([HAVE_GLEW_1_12])])
+-
+-dnl ===================================================================
+ dnl Check for system odbc
+ dnl ===================================================================
+ AC_MSG_CHECKING([which odbc headers to use])
+@@ -10465,7 +10462,7 @@ if test "x$enable_gltf" != "xno" -a $_os != iOS -a $_os != Android -a "$ENABLE_H
+     AC_DEFINE(HAVE_FEATURE_GLTF,1)
+     if test "$with_system_libgltf" = "yes"; then
+         SYSTEM_LIBGLTF=TRUE
+-        PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
++        PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.1 >= 0.1.0] )
+         FilterLibs "${LIBGLTF_LIBS}"
+         LIBGLTF_LIBS="${filteredlibs}"
+     else
+@@ -11696,6 +11693,11 @@ AC_SUBST(CAIRO_CFLAGS)
+ AC_SUBST(CAIRO_LIBS)
+ 
+ dnl ===================================================================
++dnl Check for system epoxy
++dnl ===================================================================
++libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.3.1], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
++
++dnl ===================================================================
+ dnl Test whether to use avahi
+ dnl ===================================================================
+ if test "$_os" = "WINNT"; then
+@@ -12854,7 +12856,6 @@ AC_CONFIG_HEADERS([config_host/config_locales.h])
+ AC_CONFIG_HEADERS([config_host/config_orcus.h])
+ AC_CONFIG_HEADERS([config_host/config_kde4.h])
+ AC_CONFIG_HEADERS([config_host/config_oox.h])
+-AC_CONFIG_HEADERS([config_host/config_opengl.h])
+ AC_CONFIG_HEADERS([config_host/config_options.h])
+ AC_CONFIG_HEADERS([config_host/config_options_calc.h])
+ AC_CONFIG_HEADERS([config_host/config_test.h])
+diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
+index 6a63a1d..64f7844 100644
+--- a/cui/Library_cui.mk
++++ b/cui/Library_cui.mk
+@@ -72,7 +72,7 @@ $(eval $(call gb_Library_use_externals,cui,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,cui,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+diff --git a/distro-configs/LibreOfficeFlatpak.conf b/distro-configs/LibreOfficeFlatpak.conf
+index d5d6686..121d198 100644
+--- a/distro-configs/LibreOfficeFlatpak.conf
++++ b/distro-configs/LibreOfficeFlatpak.conf
+@@ -11,7 +11,6 @@
+ --without-system-coinmp
+ --without-system-cppunit
+ --without-system-firebird
+---without-system-glew
+ --without-system-glm
+ --without-system-libabw
+ --without-system-libcdr
+diff --git a/download.lst b/download.lst
+index 3e3313b..9d7af4f 100644
+--- a/download.lst
++++ b/download.lst
+@@ -29,6 +29,8 @@ export CURL_TARBALL := curl-7.51.0.tar.gz
+ export DBGHELP_DLL := 13fbc2e8b37ddf28181dd6d8081c2b8e-dbghelp.dll
+ export EBOOK_MD5SUM := 6b48eda57914e6343efebc9381027b78
+ export EBOOK_TARBALL := libe-book-0.1.2.tar.bz2
++export EPOXY_MD5SUM := 96f6620a9b005a503e7b44b0b528287d
++export EPOXY_TARBALL := libepoxy-1.3.1.tar.bz2
+ export EPM_TARBALL := 3ade8cfe7e59ca8e65052644fed9fca4-epm-3.7.tar.gz
+ export ETONYEK_MD5SUM := 77ff46936dcc83670557274e7dd2aa33
+ export ETONYEK_VERSION_MICRO := 6
+@@ -54,7 +56,6 @@ export FONT_EMOJIONE_COLOR_TARBALL := EmojiOneColor-SVGinOT-1.3.tar.gz
+ export FREEHAND_MD5SUM := 8cf70c5dc4d24d2dc4a107f509d2d6d7
+ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
+ export FREETYPE_TARBALL := dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
+-export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
+ export GLM_TARBALL := bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
+ export GRAPHITE_TARBALL := 3069842a88b8f40c6b83ad2850cda293-graphite2-minimal-1.3.9.tgz
+ export HARFBUZZ_MD5SUM := 5986e1bfcd983d1f6caa53ef64c4abc5
+@@ -88,8 +89,8 @@ export LIBATOMIC_OPS_TARBALL := libatomic_ops-7_2d.zip
+ export LIBEOT_MD5SUM := aa24f5dd2a2992f4a116aa72af817548
+ export LIBEOT_TARBALL := libeot-0.01.tar.bz2
+ export LIBEXTTEXTCAT_TARBALL := 10d61fbaa6a06348823651b1bd7940fe-libexttextcat-3.4.4.tar.bz2
+-export LIBGLTF_MD5SUM := d63a9f47ab048f5009d90693d6aa6424
+-export LIBGLTF_TARBALL := libgltf-0.0.2.tar.bz2
++export LIBGLTF_MD5SUM := 63ae962d0c436909979826fce0fca2fd
++export LIBGLTF_TARBALL := libgltf-0.1.0.tar.gz
+ export LIBLANGTAG_MD5SUM := 284f120247323a35122ab32b4b359c45
+ export LIBLANGTAG_TARBALL := liblangtag-0.6.2.tar.bz2
+ export LIBTOMMATH_MD5SUM := da283d2e3e72137d0c600ac36b991c9d
+diff --git a/external/Module_external.mk b/external/Module_external.mk
+index 1dbf97b..c14e668 100644
+--- a/external/Module_external.mk
++++ b/external/Module_external.mk
+@@ -38,13 +38,13 @@ $(eval $(call gb_Module_add_moduledirs,external,\
+ 	$(call gb_Helper_optional,CURL,curl) \
+ 	$(call gb_Helper_optional,EBOOK,libebook) \
+ 	$(call gb_Helper_optional,EPM,epm) \
++	$(call gb_Helper_optional,EPOXY,epoxy) \
+ 	$(call gb_Helper_optional,ETONYEK,libetonyek) \
+ 	$(call gb_Helper_optional,EXPAT,expat) \
+ 	$(call gb_Helper_optional,FIREBIRD,firebird) \
+ 	$(call gb_Helper_optional,FONTCONFIG,fontconfig) \
+ 	$(call gb_Helper_optional,FREEHAND,libfreehand) \
+ 	$(call gb_Helper_optional,FREETYPE,freetype) \
+-	$(call gb_Helper_optional,GLEW,glew) \
+ 	$(call gb_Helper_optional,GLM,glm) \
+ 	$(call gb_Helper_optional,GRAPHITE,graphite) \
+ 	$(call gb_Helper_optional,HARFBUZZ,harfbuzz) \
+diff --git a/external/epoxy/Library_epoxy.mk b/external/epoxy/Library_epoxy.mk
+new file mode 100644
+index 0000000..28f9dab
+--- /dev/null
++++ b/external/epoxy/Library_epoxy.mk
+@@ -0,0 +1,63 @@
++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
++#
++# This file is part of the LibreOffice project.
++#
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++#
++
++$(eval $(call gb_Library_Library,epoxy))
++
++$(eval $(call gb_Library_use_unpacked,epoxy,epoxy))
++
++$(eval $(call gb_Library_set_warnings_not_errors,epoxy))
++
++$(eval $(call gb_Library_set_include,epoxy,\
++	-I$(WORKDIR)/UnpackedTarball/epoxy/include \
++	-I$(WORKDIR)/UnpackedTarball/epoxy/src \
++	$$(INCLUDE) \
++))
++
++# epoxy is riddled with warnings... let's spare use
++# the pointless spamming
++$(eval $(call gb_Library_add_cxxflags,epoxy,\
++	-w \
++))
++$(eval $(call gb_Library_add_cflags,epoxy,\
++	-w \
++))
++
++ifeq ($(OS),LINUX)
++$(eval $(call gb_Library_add_libs,epoxy,\
++	-ldl \
++))
++endif
++
++$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
++	UnpackedTarball/epoxy/src/dispatch_common \
++	UnpackedTarball/epoxy/src/gl_generated_dispatch \
++))
++
++ifeq ($(OS),WNT)
++$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
++	UnpackedTarball/epoxy/src/dispatch_wgl \
++	UnpackedTarball/epoxy/src/wgl_generated_dispatch \
++))
++else ifeq ($(OS),MACOSX)
++# nothing
++else ifeq ($(OS),ANDROID)
++$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
++	UnpackedTarball/epoxy/src/dispatch_egl \
++	UnpackedTarball/epoxy/src/egl_generated_dispatch \
++))
++else
++$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
++	UnpackedTarball/epoxy/src/dispatch_glx \
++	UnpackedTarball/epoxy/src/glx_generated_dispatch \
++	UnpackedTarball/epoxy/src/dispatch_egl \
++	UnpackedTarball/epoxy/src/egl_generated_dispatch \
++))
++endif
++
++# vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/Makefile b/external/epoxy/Makefile
+new file mode 100644
+index 0000000..e4968cf8
+--- /dev/null
++++ b/external/epoxy/Makefile
+@@ -0,0 +1,7 @@
++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
++
++module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
++
++include $(module_directory)/../../solenv/gbuild/partial_build.mk
++
++# vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/Module_epoxy.mk b/external/epoxy/Module_epoxy.mk
+new file mode 100644
+index 0000000..ea65176
+--- /dev/null
++++ b/external/epoxy/Module_epoxy.mk
+@@ -0,0 +1,17 @@
++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
++#
++# This file is part of the LibreOffice project.
++#
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++#
++
++$(eval $(call gb_Module_Module,epoxy))
++
++$(eval $(call gb_Module_add_targets,epoxy,\
++	Library_epoxy \
++	UnpackedTarball_epoxy \
++))
++
++# vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/README b/external/epoxy/README
+new file mode 100644
+index 0000000..8bd467a
+--- /dev/null
++++ b/external/epoxy/README
+@@ -0,0 +1,5 @@
++Epoxy is an OpenGL Extension Wrangler
++
++Epoxy is a library for handling OpenGL function pointer management for you
++
++https://github.com/anholt/libepoxy
+diff --git a/external/epoxy/UnpackedTarball_epoxy.mk b/external/epoxy/UnpackedTarball_epoxy.mk
+new file mode 100644
+index 0000000..76c0fdf
+--- /dev/null
++++ b/external/epoxy/UnpackedTarball_epoxy.mk
+@@ -0,0 +1,20 @@
++# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
++#
++# This file is part of the LibreOffice project.
++#
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++#
++
++$(eval $(call gb_UnpackedTarball_UnpackedTarball,epoxy))
++
++$(eval $(call gb_UnpackedTarball_set_tarball,epoxy,$(EPOXY_TARBALL)))
++
++$(eval $(call gb_UnpackedTarball_set_patchlevel,epoxy,0))
++
++$(eval $(call gb_UnpackedTarball_add_patches,epoxy, \
++    external/epoxy/epoxy.windows.api.patch \
++))
++
++# vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/epoxy.windows.api.patch b/external/epoxy/epoxy.windows.api.patch
+new file mode 100644
+index 0000000..12d2afb
+--- /dev/null
++++ b/external/epoxy/epoxy.windows.api.patch
+@@ -0,0 +1,90 @@
++--- include/epoxy/gl.h
+++++ include/epoxy/gl.h
++@@ -59,7 +59,8 @@
++ 
++ #else
++ #ifndef APIENTRY
++-#define APIENTRY __stdcall
+++#define WINAPI __stdcall
+++#define APIENTRY WINAPI
++ #endif
++ 
++ #ifndef GLAPIENTRY
++--- src/egl_generated_dispatch.c
+++++ src/egl_generated_dispatch.c
++@@ -128,7 +128,11 @@
++ };
++ 
++ #if USING_DISPATCH_TABLE
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void);
++ 
++ #endif
++@@ -1642,7 +1646,11 @@
++ uint32_t egl_tls_index;
++ uint32_t egl_tls_size = sizeof(struct dispatch_table);
++ 
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void)
++ {
++ 	return TlsGetValue(egl_tls_index);
++--- src/gl_generated_dispatch.c
+++++ src/gl_generated_dispatch.c
++@@ -3122,7 +3122,11 @@
++ };
++ 
++ #if USING_DISPATCH_TABLE
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void);
++ 
++ #endif
++@@ -51507,7 +51511,11 @@
++ uint32_t gl_tls_index;
++ uint32_t gl_tls_size = sizeof(struct dispatch_table);
++ 
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void)
++ {
++ 	return TlsGetValue(gl_tls_index);
++--- src/wgl_generated_dispatch.c
+++++ src/wgl_generated_dispatch.c
++@@ -157,7 +157,11 @@
++ };
++ 
++ #if USING_DISPATCH_TABLE
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void);
++ 
++ #endif
++@@ -1701,7 +1705,11 @@
++ uint32_t wgl_tls_index;
++ uint32_t wgl_tls_size = sizeof(struct dispatch_table);
++ 
+++#if defined (_MSC_VER)
+++static __inline struct dispatch_table *
+++#else
++ static inline struct dispatch_table *
+++#endif
++ get_dispatch_table(void)
++ {
++ 	return TlsGetValue(wgl_tls_index);
+diff --git a/external/glew/ExternalPackage_glew.mk b/external/glew/ExternalPackage_glew.mk
+deleted file mode 100644
+index e6adc8b..0000000
+--- a/external/glew/ExternalPackage_glew.mk
++++ /dev/null
+@@ -1,33 +0,0 @@
+-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+-#
+-# This file is part of the LibreOffice project.
+-#
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-#
+-
+-$(eval $(call gb_ExternalPackage_ExternalPackage,glew,glew))
+-
+-$(eval $(call gb_ExternalPackage_use_external_project,glew,glew))
+-
+-ifeq ($(OS)-$(COM),WNT-MSC)
+-ifeq ($(CPUNAME),INTEL)
+-glew_arch_subdir=Win32
+-else ifeq ($(CPUNAME),X86_64)
+-glew_arch_subdir=x64
+-endif
+-endif
+-
+-ifeq ($(OS),MACOSX)
+-$(eval $(call gb_ExternalPackage_add_file,glew,$(LIBO_LIB_FOLDER)/libGLEW.1.12.0.dylib,lib/libGLEW.1.12.0.dylib))
+-else ifeq ($(OS)-$(COM),WNT-GCC)
+-else ifeq ($(COM),MSC)
+-$(eval $(call gb_ExternalPackage_add_files,glew,$(LIBO_LIB_FOLDER), \
+-	bin/$(if $(MSVC_USE_DEBUG_RUNTIME),Debug/$(glew_arch_subdir)/glew32d.dll,Release/$(glew_arch_subdir)/glew32.dll) \
+-))
+-else ifeq ($(DISABLE_DYNLOADING),)
+-$(eval $(call gb_ExternalPackage_add_file,glew,$(LIBO_LIB_FOLDER)/libGLEW.so.1.12,lib/libGLEW.so.1.12.0))
+-endif
+-
+-# vim: set noet sw=4 ts=4:
+diff --git a/external/glew/ExternalProject_glew.mk b/external/glew/ExternalProject_glew.mk
+deleted file mode 100644
+index 0d80cd0..0000000
+--- a/external/glew/ExternalProject_glew.mk
++++ /dev/null
+@@ -1,36 +0,0 @@
+-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+-#
+-# This file is part of the LibreOffice project.
+-#
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-#
+-
+-$(eval $(call gb_ExternalProject_ExternalProject,glew))
+-
+-$(eval $(call gb_ExternalProject_register_targets,glew,\
+-	build \
+-))
+-
+-ifeq ($(COM),MSC)
+-$(call gb_ExternalProject_get_state_target,glew,build) :
+-	$(call gb_ExternalProject_run,build,\
+-		$(if $(filter 140,$(VCVER)),$(DEVENV) /Upgrade glew.sln,echo up-to-date) && \
+-		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) \
+-	,build/vc12) \
+-	$(call gb_ExternalProject_run,build,\
+-		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) \
+-	,build/vc12)
+-
+-else
+-
+-$(call gb_ExternalProject_get_state_target,glew,build) :
+-	$(call gb_ExternalProject_run,glew,\
+-		$(if $(ENABLE_DEBUG),STRIP=) LD="$(CC)" \
+-			$(MAKE) STRIP= glew.lib $(if $(filter DESKTOP,$(BUILD_TYPE)),$(if $(ENABLE_DEBUG),debug)) \
+-	)
+-
+-endif
+-
+-# vim: set noet sw=4 ts=4:
+diff --git a/external/glew/Makefile b/external/glew/Makefile
+deleted file mode 100644
+index e4968cf8..0000000
+--- a/external/glew/Makefile
++++ /dev/null
+@@ -1,7 +0,0 @@
+-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+-
+-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+-
+-include $(module_directory)/../../solenv/gbuild/partial_build.mk
+-
+-# vim: set noet sw=4 ts=4:
+diff --git a/external/glew/Module_glew.mk b/external/glew/Module_glew.mk
+deleted file mode 100644
+index 1d1b9a7..0000000
+--- a/external/glew/Module_glew.mk
++++ /dev/null
+@@ -1,18 +0,0 @@
+-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+-#
+-# This file is part of the LibreOffice project.
+-#
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-#
+-
+-$(eval $(call gb_Module_Module,glew))
+-
+-$(eval $(call gb_Module_add_targets,glew,\
+-	ExternalProject_glew \
+-	UnpackedTarball_glew \
+-	ExternalPackage_glew \
+-))
+-
+-# vim: set noet sw=4 ts=4:
+diff --git a/external/glew/README b/external/glew/README
+deleted file mode 100644
+index 34b2d24..0000000
+--- a/external/glew/README
++++ /dev/null
+@@ -1,6 +0,0 @@
+-GLEW is the OpenGL Extension Wrangler
+-
+-GLEW provides efficient run-time mechanisms for determining which OpenGL
+-extensions are supported on the target platform.
+-
+-http://glew.sourceforge.net/
+diff --git a/external/glew/UnpackedTarball_glew.mk b/external/glew/UnpackedTarball_glew.mk
+deleted file mode 100644
+index c47b7a0..0000000
+--- a/external/glew/UnpackedTarball_glew.mk
++++ /dev/null
+@@ -1,48 +0,0 @@
+-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+-#
+-# This file is part of the LibreOffice project.
+-#
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-#
+-
+-$(eval $(call gb_UnpackedTarball_UnpackedTarball,glew))
+-
+-$(eval $(call gb_UnpackedTarball_set_tarball,glew,$(GLEW_TARBALL)))
+-
+-$(eval $(call gb_UnpackedTarball_set_patchlevel,glew,0))
+-
+-$(eval $(call gb_UnpackedTarball_fix_end_of_line,glew,\
+-	Makefile \
+-	include/GL/glew.h \
+-))
+-
+-ifeq ($(OS)$(COM),WNTMSC)
+-$(eval $(call gb_UnpackedTarball_set_patchflags,glew,--binary))
+-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
+-	external/glew/glew-msvc-disable-sse2.patch.1 \
+-))
+-else
+-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
+-	external/glew/glew_use_CC_variable.patch.1 \
+-))
+-endif
+-
+-ifeq ($(OS),MACOSX)
+-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
+-	external/glew/glew-macosx-install-name.patch.1 \
+-))
+-endif
+-
+-ifeq ($(DISABLE_DYNLOADING),TRUE)
+-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
+-	external/glew/glew-static-only.patch.1 \
+-))
+-endif
+-
+-$(eval $(call gb_UnpackedTarball_add_patches,glew,\
+-	external/glew/glew-tmpdir.patch.1 \
+-))
+-
+-# vim: set noet sw=4 ts=4:
+diff --git a/external/glew/glew-macosx-install-name.patch.1 b/external/glew/glew-macosx-install-name.patch.1
+deleted file mode 100644
+index 75e8e7f..0000000
+--- a/external/glew/glew-macosx-install-name.patch.1
++++ /dev/null
+@@ -1,13 +0,0 @@
+--*- Mode:Diff -*-
+-diff -ur glew.org/build/glew.rc glew/build/glew.rc
+---- glew/config/Makefile.darwin
+-+++ glew/config/Makefile.darwin
+-@@ -20,7 +20,7 @@
+- LIB.DEVLNK    = lib$(NAME).dylib
+- LIB.SHARED    = lib$(NAME).$(SO_VERSION).dylib
+- LIB.STATIC    = lib$(NAME).a
+--LDFLAGS.SO    = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
+-+LDFLAGS.SO    = -dynamiclib -install_name @__________________________________________________OOO/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
+- LIB.SONAME.MX = lib$(NAME)mx.$(SO_MAJOR).dylib
+- LIB.DEVLNK.MX = lib$(NAME)mx.dylib
+- LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib
+diff --git a/external/glew/glew-msvc-disable-sse2.patch.1 b/external/glew/glew-msvc-disable-sse2.patch.1
+deleted file mode 100644
+index 6b07044..0000000
+--- a/external/glew/glew-msvc-disable-sse2.patch.1
++++ /dev/null
+@@ -1,10 +0,0 @@
+---- glew/build//vc10/common.props.orig	2014-10-02 15:06:57.027060664 +0200
+-+++ glew/build//vc10/common.props	2014-10-02 15:06:59.026060509 +0200
+-@@ -10,6 +10,7 @@
+-   <ItemDefinitionGroup>
+-     <ClCompile>
+-       <AdditionalIncludeDirectories>$(INCLUDE_DIR)</AdditionalIncludeDirectories>
+-+      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+-     </ClCompile>
+-   </ItemDefinitionGroup>
+-   <ItemGroup>
+diff --git a/external/glew/glew-static-only.patch.1 b/external/glew/glew-static-only.patch.1
+deleted file mode 100644
+index 14ccff2..0000000
+--- a/external/glew/glew-static-only.patch.1
++++ /dev/null
+@@ -1,12 +0,0 @@
+--*- Mode:Diff -*-
+---- glew/Makefile
+-+++ glew/Makefile
+-@@ -93,7 +93,7 @@
+- LIB.SOBJS.MX       := $(addprefix tmp/$(SYSTEM)/mx/shared/,$(LIB.SRCS.NAMES))
+- LIB.SOBJS.MX       := $(LIB.SOBJS.MX:.c=.o)
+- 
+--glew.lib: lib lib/$(LIB.SHARED) lib/$(LIB.STATIC) glew.pc
+-+glew.lib: lib lib/$(LIB.STATIC)
+- 
+- lib:
+- 	mkdir lib
+diff --git a/external/glew/glew-tmpdir.patch.1 b/external/glew/glew-tmpdir.patch.1
+deleted file mode 100644
+index 9a2847b..0000000
+--- a/external/glew/glew-tmpdir.patch.1
++++ /dev/null
+@@ -1,13 +0,0 @@
+-diff -ur glew.org/Makefile glew/Makefile
+---- glew.org/Makefile	2016-05-02 06:25:53.521291677 +0200
+-+++ glew/Makefile	2016-05-02 06:31:10.325035494 +0200
+-@@ -55,7 +55,8 @@
+- DIST_SRC_TGZ ?= $(shell pwd)/$(DIST_NAME).tgz
+- DIST_WIN32   ?= $(shell pwd)/$(DIST_NAME)-win32.zip
+- 
+--DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME)
+-+TMPDIR ?= /tmp
+-+DIST_DIR := $(shell mktemp -d $(TMPDIR)/glew.XXXXXX)/$(DIST_NAME)
+- 
+- # To disable stripping of binaries either:
+- #   - use STRIP= on gmake command-line
+diff --git a/external/glew/glew_use_CC_variable.patch.1 b/external/glew/glew_use_CC_variable.patch.1
+deleted file mode 100644
+index 56e9903..0000000
+--- a/external/glew/glew_use_CC_variable.patch.1
++++ /dev/null
+@@ -1,24 +0,0 @@
+-Use CC variable from environment, don't hardcode "cc".
+-
+---- glew/config/Makefile.linux.orig	2014-01-29 15:39:43.364972925 +0100
+-+++ glew/config/Makefile.linux	2014-01-29 15:44:45.621000941 +0100
+-@@ -1,6 +1,6 @@
+- NAME = $(GLEW_NAME)
+--CC = cc
+--LD = cc
+-+CC ?= cc
+-+LD ?= $(CC)
+- M_ARCH ?= $(shell uname -m)
+- ARCH64 = false
+- ifeq (x86_64,${M_ARCH})
+---- glew/config/Makefile.darwin.orig	2014-01-29 15:44:39.541000377 +0100
+-+++ glew/config/Makefile.darwin	2014-01-29 15:44:47.548001120 +0100
+-@@ -1,6 +1,6 @@
+- NAME = $(GLEW_NAME)
+--CC = cc
+--LD = cc
+-+CC ?= cc
+-+LD ?= $(CC)
+- CFLAGS.EXTRA = -dynamic -fno-common
+- #CFLAGS.EXTRA += -no-cpp-precomp
+- LDFLAGS.EXTRA =
+diff --git a/external/libgltf/ExternalProject_libgltf.mk b/external/libgltf/ExternalProject_libgltf.mk
+index 57c01d0..90a1d96 100644
+--- a/external/libgltf/ExternalProject_libgltf.mk
++++ b/external/libgltf/ExternalProject_libgltf.mk
+@@ -17,7 +17,7 @@ $(eval $(call gb_ExternalProject_register_targets,libgltf,\
+ 
+ $(eval $(call gb_ExternalProject_use_externals,libgltf,\
+ 	boost_headers \
+-	glew \
++	epoxy \
+ 	glm_headers \
+ ))
+ 
+@@ -30,8 +30,8 @@ ifeq ($(SYSTEM_BOOST),)
+ libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,boost)"
+ endif
+ 
+-ifeq ($(SYSTEM_GLEW),)
+-libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,glew)/include"
++ifeq ($(SYSTEM_EPOXY),)
++libgltf_AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,epoxy)/include"
+ endif
+ 
+ ifeq ($(SYSTEM_GLM),)
+@@ -45,7 +45,7 @@ $(call gb_ExternalProject_get_state_target,libgltf,build) :
+ 			$(if $(filter 120,$(VCVER)),/p:PlatformToolset=v120 /p:VisualStudioVersion=12.0 /ToolsVersion:12.0) \
+ 			$(if $(filter 140,$(VCVER)),/p:PlatformToolset=v140 /p:VisualStudioVersion=14.0 /ToolsVersion:14.0) \
+ 			'/p:AdditionalIncludeDirectories=$(subst $(WHITESPACE),;,$(subst /,\,$(strip $(libgltf_AdditionalIncludes))))' \
+-			/p:AdditionalLibraryDirectories=$(if $(SYSTEM_GLEW),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,glew))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \
++			/p:AdditionalLibraryDirectories=$(if $(SYSTEM_EPOXY),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,epoxy))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \
+ 	,build/win32)
+ 
+ else # !ifeq($(COM),MSC)
+@@ -67,7 +67,7 @@ $(call gb_ExternalProject_get_state_target,libgltf,build) :
+ 			$(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
+ 			--disable-werror \
+ 			BOOST_CFLAGS="$(BOOST_CPPFLAGS)" \
+-			GLEW_CFLAGS="$(if $(SYSTEM_GLEW),$(GLEW_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glew)/include) -DGLEW_NO_GLU" \
++			EPOXY_CFLAGS="$(if $(SYSTEM_EPOXY),$(EPOXY_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,epoxy)/include)" \
+ 			GLM_CFLAGS="$(if $(SYSTEM_GLM),$(GLM_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glm))" \
+ 			$(if $(libgltf_CPPFLAGS),CPPFLAGS='$(libgltf_CPPFLAGS)') \
+ 		&& $(MAKE) \
+diff --git a/external/libgltf/libgltf-msvc-x64.patch.1 b/external/libgltf/libgltf-msvc-x64.patch.1
+index 86417a7..32a831b 100644
+--- a/external/libgltf/libgltf-msvc-x64.patch.1
++++ b/external/libgltf/libgltf-msvc-x64.patch.1
+@@ -20,7 +20,7 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
+    </ItemGroup>
+    <ItemGroup>
+      <ClInclude Include="..\..\inc\libgltf.h" />
+-@@ -56,6 +64,12 @@
++@@ -53,6 +61,12 @@
+      <CharacterSet>MultiByte</CharacterSet>
+      <PlatformToolset>v110</PlatformToolset>
+    </PropertyGroup>
+@@ -33,7 +33,7 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
+    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+      <ConfigurationType>StaticLibrary</ConfigurationType>
+      <UseDebugLibraries>false</UseDebugLibraries>
+-@@ -63,15 +77,28 @@
++@@ -60,15 +74,28 @@
+      <CharacterSet>MultiByte</CharacterSet>
+      <PlatformToolset>v110</PlatformToolset>
+    </PropertyGroup>
+@@ -62,8 +62,8 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
+    <PropertyGroup Label="UserMacros" />
+    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      <ClCompile>
+-@@ -86,6 +113,19 @@
+-       <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
++@@ -83,10 +110,42 @@
++       <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
+      </Link>
+    </ItemDefinitionGroup>
+ +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+@@ -76,20 +76,13 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
+ +    <Link>
+ +      <GenerateDebugInformation>true</GenerateDebugInformation>
+ +      <AdditionalLibraryDirectories>$(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+-+      <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
+++      <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
+ +    </Link>
+ +  </ItemDefinitionGroup>
+    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      <ClCompile>
+        <WarningLevel>Level4</WarningLevel>
+-@@ -105,6 +145,25 @@
+-       <SubSystem>Windows</SubSystem>
+-     </Link>
+-   </ItemDefinitionGroup>
+-+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+-+    <ClCompile>
+-+      <WarningLevel>Level4</WarningLevel>
+-+      <Optimization>MaxSpeed</Optimization>
++       <Optimization>MaxSpeed</Optimization>
+ +      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+ +      <FunctionLevelLinking>true</FunctionLevelLinking>
+ +      <IntrinsicFunctions>true</IntrinsicFunctions>
+@@ -101,10 +94,14 @@ diff -ur libgltf.org/build/win32/libgltf.vcxproj libgltf/build/win32/libgltf.vcx
+ +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ +      <OptimizeReferences>true</OptimizeReferences>
+ +      <AdditionalLibraryDirectories>$(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+-+      <AdditionalDependencies>opengl32.lib;glew32.lib;$(AdditionalDependencies)</AdditionalDependencies>
+++      <AdditionalDependencies>opengl32.lib;epoxy32.lib;$(AdditionalDependencies)</AdditionalDependencies>
+ +      <SubSystem>Windows</SubSystem>
+ +    </Link>
+ +  </ItemDefinitionGroup>
+-   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+-   <ImportGroup Label="ExtensionTargets">
+-   </ImportGroup>
+++  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+++    <ClCompile>
+++      <WarningLevel>Level4</WarningLevel>
+++      <Optimization>MaxSpeed</Optimization>
++       <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
++       <FunctionLevelLinking>true</FunctionLevelLinking>
++       <IntrinsicFunctions>true</IntrinsicFunctions>
+diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
+index e77a6e9..37d354e 100644
+--- a/include/vcl/opengl/OpenGLContext.hxx
++++ b/include/vcl/opengl/OpenGLContext.hxx
+@@ -12,7 +12,7 @@
+ 
+ #include <string.h>
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ 
+ #include <vcl/dllapi.h>
+ #include <vcl/window.hxx>
+@@ -158,8 +158,8 @@ private:
+     virtual void destroyCurrentContext();
+ 
+ protected:
+-    bool InitGLEW();
+-    static void InitGLEWDebugging();
++    bool InitGL();
++    static void InitGLDebugging();
+     static void InitChildWindow(SystemChildWindow *pChildWindow);
+     static void BuffersSwapped();
+     virtual GLWindow& getModifiableOpenGLWindow() = 0;
+diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
+index 458021f..23b9b79 100644
+--- a/include/vcl/opengl/OpenGLHelper.hxx
++++ b/include/vcl/opengl/OpenGLHelper.hxx
+@@ -10,7 +10,7 @@
+ #ifndef INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
+ #define INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ #include <sal/log.hxx>
+ #include <vcl/dllapi.h>
+ #include <vcl/bitmapex.hxx>
+diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx
+index 5032234..9c61a11 100644
+--- a/include/vcl/opengl/OpenGLWrapper.hxx
++++ b/include/vcl/opengl/OpenGLWrapper.hxx
+@@ -7,7 +7,7 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
+-// Fully wrapped methods that have no exotic GL / GLEW header deps.
++// Fully wrapped methods that have no exotic GL header deps.
+ 
+ #ifndef INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
+ #define INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX
+diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk
+index b908a0b..fb04596 100644
+--- a/slideshow/Library_OGLTrans.mk
++++ b/slideshow/Library_OGLTrans.mk
+@@ -34,7 +34,7 @@ $(eval $(call gb_Library_use_libraries,OGLTrans,\
+ 
+ $(eval $(call gb_Library_use_externals,OGLTrans,\
+ 	boost_headers \
+-	glew \
++	epoxy \
+ 	glm_headers \
+ ))
+ 
+@@ -56,13 +56,6 @@ $(eval $(call gb_Library_use_system_win32_libs,OGLTrans,\
+     opengl32 \
+ ))
+ 
+-else
+-
+-$(eval $(call gb_Library_add_libs,OGLTrans,\
+-	-lGL \
+-	-lX11 \
+-))
+-
+ endif
+ 
+ $(eval $(call gb_Library_add_exception_objects,OGLTrans,\
+diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
+index 3a9aac6..0583f5e 100644
+--- a/slideshow/Library_slideshow.mk
++++ b/slideshow/Library_slideshow.mk
+@@ -31,7 +31,7 @@ $(eval $(call gb_Library_use_externals,slideshow,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,slideshow,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
+index a807fff..1c69121 100644
+--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
++++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
+@@ -26,7 +26,6 @@
+  *
+  ************************************************************************/
+ 
+-#include <GL/glew.h>
+ #include <glm/gtc/matrix_transform.hpp>
+ #include <glm/gtc/type_ptr.hpp>
+ #include <vcl/opengl/OpenGLHelper.hxx>
+diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx
+index 9ee73dd..6f2e164 100644
+--- a/slideshow/source/engine/opengl/TransitionImpl.hxx
++++ b/slideshow/source/engine/opengl/TransitionImpl.hxx
+@@ -31,8 +31,6 @@
+ #include <config_lgpl.h>
+ #include <glm/gtc/type_ptr.hpp>
+ 
+-#include <GL/glew.h>
+-
+ #include <memory>
+ #include <vector>
+ 
+diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
+index ef1d385..01cd3e5 100644
+--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
++++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
+@@ -810,7 +810,7 @@ void buildMipmaps(
+     GLint internalFormat, GLsizei width, GLsizei height, GLenum format,
+     GLenum type, const void * data)
+ {
+-    if (GLEW_ARB_framebuffer_object) {
++    if (epoxy_has_gl_extension("GL_ARB_framebuffer_object")) {
+         glTexImage2D(
+             GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type,
+             data);
+diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
+index 557c427..48ecf22 100644
+--- a/svx/Library_svxcore.mk
++++ b/svx/Library_svxcore.mk
+@@ -88,7 +88,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,svxcore,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
+index 27bd721..b9a42d3 100644
+--- a/toolkit/Library_tk.mk
++++ b/toolkit/Library_tk.mk
+@@ -27,7 +27,7 @@ $(eval $(call gb_Library_use_externals,tk,\
+ 
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,tk,\
+-    glew \
++    epoxy \
+ ))
+ endif
+ $(eval $(call gb_Library_set_include,tk,\
+diff --git a/vcl/CppunitTest_vcl_bitmap_test.mk b/vcl/CppunitTest_vcl_bitmap_test.mk
+index 879c7ac..70ce156 100644
+--- a/vcl/CppunitTest_vcl_bitmap_test.mk
++++ b/vcl/CppunitTest_vcl_bitmap_test.mk
+@@ -19,7 +19,7 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_bitmap_test,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_CppunitTest_use_externals,vcl_bitmap_test,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/vcl/CppunitTest_vcl_wmf_test.mk
+index 369c792..7cae363 100644
+--- a/vcl/CppunitTest_vcl_wmf_test.mk
++++ b/vcl/CppunitTest_vcl_wmf_test.mk
+@@ -87,7 +87,7 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+@@ -136,7 +136,6 @@ $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+     -lm \
+     -ldl \
+     -lpthread \
+-    -lGL \
+     -lX11 \
+ ))
+ endif
+@@ -190,7 +189,6 @@ ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
+ $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+     -lm $(DLOPEN_LIBS) \
+     -lpthread \
+-    -lGL \
+     -lX11 \
+     -lXext \
+ ))
+diff --git a/vcl/Executable_icontest.mk b/vcl/Executable_icontest.mk
+index 102697b..cce8feb 100644
+--- a/vcl/Executable_icontest.mk
++++ b/vcl/Executable_icontest.mk
+@@ -15,7 +15,7 @@ $(eval $(call gb_Executable_use_externals,icontest,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Executable_use_externals,icontest,\
+-    glew \
++    epoxy \
+ ))
+ endif
+ 
+diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk
+index bff091e..a09d3b4 100644
+--- a/vcl/Executable_vcldemo.mk
++++ b/vcl/Executable_vcldemo.mk
+@@ -21,7 +21,7 @@ $(eval $(call gb_Executable_use_externals,vcldemo,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Executable_use_externals,vcldemo,\
+-    glew \
++    epoxy \
+ ))
+ endif
+ 
+diff --git a/vcl/Executable_visualbackendtest.mk b/vcl/Executable_visualbackendtest.mk
+index abf8cbe..8704453 100644
+--- a/vcl/Executable_visualbackendtest.mk
++++ b/vcl/Executable_visualbackendtest.mk
+@@ -46,7 +46,6 @@ $(eval $(call gb_Executable_add_libs,visualbackendtest,\
+ 	-lm \
+ 	-ldl \
+ 	-lpthread \
+-    -lGL \
+     -lX11 \
+ ))
+ 
+diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
+index 1aae3d7..ebffb7c 100644
+--- a/vcl/Library_vcl.mk
++++ b/vcl/Library_vcl.mk
+@@ -122,7 +122,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
+ ))
+ ifeq ($(ENABLE_HEADLESS),)
+ $(eval $(call gb_Library_use_externals,vcl,\
+-     glew \
++     epoxy \
+  ))
+ endif
+ 
+@@ -647,7 +647,6 @@ $(eval $(call gb_Library_add_libs,vcl,\
+ 	-lm \
+ 	-ldl \
+ 	-lpthread \
+-    -lGL \
+     -lX11 \
+ ))
+ endif
+diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
+index f281605..0e1c39c 100644
+--- a/vcl/Library_vclplug_gen.mk
++++ b/vcl/Library_vclplug_gen.mk
+@@ -51,7 +51,7 @@ $(eval $(call gb_Library_use_externals,vclplug_gen,\
+ 	boost_headers \
+ 	cairo \
+ 	graphite \
+-	glew \
++	epoxy \
+ 	glm_headers \
+ 	harfbuzz \
+ 	icu_headers \
+@@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_libs,vclplug_gen,\
+ 	-lXext \
+ 	-lSM \
+ 	-lICE \
+-	-lGL \
+ ))
+ 
+ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
+diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
+index c32a127..67247b7 100644
+--- a/vcl/Library_vclplug_gtk.mk
++++ b/vcl/Library_vclplug_gtk.mk
+@@ -59,7 +59,7 @@ $(eval $(call gb_Library_use_externals,vclplug_gtk,\
+ 	cairo \
+ 	dbus \
+ 	gio \
+-	glew \
++	epoxy \
+ 	gtk \
+ 	gthread \
+ 	icuuc \
+diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
+index 8d013d9..1457c1a 100644
+--- a/vcl/Library_vclplug_gtk3.mk
++++ b/vcl/Library_vclplug_gtk3.mk
+@@ -75,7 +75,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_gtk3,\
+ 
+ $(eval $(call gb_Library_use_externals,vclplug_gtk3,\
+ 	boost_headers \
+-	glew \
++	epoxy \
+ 	dbus \
+ ))
+ 
+diff --git a/vcl/Library_vclplug_kde4.mk b/vcl/Library_vclplug_kde4.mk
+index 30c4069..acd7bd5 100644
+--- a/vcl/Library_vclplug_kde4.mk
++++ b/vcl/Library_vclplug_kde4.mk
+@@ -54,7 +54,7 @@ $(eval $(call gb_Library_use_externals,vclplug_kde4,\
+ 	boost_headers \
+ 	icuuc \
+ 	kde4 \
+-	glew \
++	epoxy \
+ ))
+ 
+ $(eval $(call gb_Library_add_libs,vclplug_kde4,\
+diff --git a/vcl/inc/opengl/LineRenderUtils.hxx b/vcl/inc/opengl/LineRenderUtils.hxx
+index 58ae6a8..e3f375b 100644
+--- a/vcl/inc/opengl/LineRenderUtils.hxx
++++ b/vcl/inc/opengl/LineRenderUtils.hxx
+@@ -11,7 +11,6 @@
+ #ifndef INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H
+ #define INCLUDED_VCL_INC_OPENGL_LINERENDERUTILS_H
+ 
+-#include <GL/glew.h>
+ #include "opengl/VertexUtils.hxx"
+ #include "opengl/RenderList.hxx"
+ 
+diff --git a/vcl/inc/opengl/VertexUtils.hxx b/vcl/inc/opengl/VertexUtils.hxx
+index f9804ec..de2c070 100644
+--- a/vcl/inc/opengl/VertexUtils.hxx
++++ b/vcl/inc/opengl/VertexUtils.hxx
+@@ -12,7 +12,7 @@
+ #define INCLUDED_VCL_INC_OPENGL_VERTEXUTILS_H
+ 
+ #include <basegfx/numeric/ftools.hxx>
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ #include <glm/gtx/norm.hpp>
+ #include <vcl/salgtype.hxx>
+ #include <vector>
+diff --git a/vcl/inc/opengl/framebuffer.hxx b/vcl/inc/opengl/framebuffer.hxx
+index ec7a450..a2dbd1e 100644
+--- a/vcl/inc/opengl/framebuffer.hxx
++++ b/vcl/inc/opengl/framebuffer.hxx
+@@ -10,7 +10,6 @@
+ #ifndef INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H
+ #define INCLUDED_VCL_INC_OPENGL_FRAMEBUFFER_H
+ 
+-#include <GL/glew.h>
+ #include <vcl/dllapi.h>
+ 
+ #include <opengl/texture.hxx>
+diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
+index 73cdb7f..4632ddf 100644
+--- a/vcl/inc/opengl/program.hxx
++++ b/vcl/inc/opengl/program.hxx
+@@ -14,7 +14,6 @@
+ 
+ #include <list>
+ 
+-#include <GL/glew.h>
+ #include <vcl/dllapi.h>
+ 
+ #include <basegfx/point/b2dpoint.hxx>
+diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
+index a0c8029..fd4eb97 100644
+--- a/vcl/inc/opengl/texture.hxx
++++ b/vcl/inc/opengl/texture.hxx
+@@ -20,7 +20,7 @@
+ #ifndef INCLUDED_VCL_INC_OPENGL_TEXTURE_H
+ #define INCLUDED_VCL_INC_OPENGL_TEXTURE_H
+ 
+-#include <GL/glew.h>
++#include <epoxy/gl.h>
+ #include <vcl/dllapi.h>
+ #include <vcl/salgtype.hxx>
+ #include <rtl/ustring.hxx>
+diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
+index 235bb91..7d32977 100644
+--- a/vcl/inc/pch/precompiled_vcl.hxx
++++ b/vcl/inc/pch/precompiled_vcl.hxx
+@@ -55,6 +55,7 @@
+ #include <boost/math/special_functions/sinc.hpp>
+ #include <boost/multi_array.hpp>
+ #include <boost/optional.hpp>
++#include <epoxy/gl.h>
+ #include <osl/conditn.hxx>
+ #include <osl/diagnose.h>
+ #include <osl/diagnose.hxx>
+@@ -183,7 +184,6 @@
+ #include <vcl/virdev.hxx>
+ #include <vcl/window.hxx>
+ #include <vcl/wrkwin.hxx>
+-#include <GL/glew.h>
+ #include <PhysicalFontCollection.hxx>
+ #include <PhysicalFontFace.hxx>
+ #include <PhysicalFontFamily.hxx>
+diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
+index 64998df..339ba80 100644
+--- a/vcl/inc/unx/saldisp.hxx
++++ b/vcl/inc/unx/saldisp.hxx
+@@ -28,7 +28,7 @@ class   SalXLib;
+ #include <X11/Xlib.h>
+ #include <X11/Xutil.h>
+ #include <X11/extensions/Xrender.h>
+-#include "GL/glxew.h"
++#include <epoxy/glx.h>
+ 
+ #include <unx/salunx.h>
+ #include <unx/saltype.h>
+diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
+index 1704a19..0d0159d 100644
+--- a/vcl/opengl/win/gdiimpl.cxx
++++ b/vcl/opengl/win/gdiimpl.cxx
+@@ -16,9 +16,10 @@
+ #include <win/saldata.hxx>
+ #include <win/salframe.h>
+ #include <win/salinst.h>
+-#include <GL/wglew.h>
++#include <epoxy/wgl.h>
+ 
+ static std::vector<HGLRC> g_vShareList;
++static bool g_bAnyCurrent;
+ 
+ class GLWinWindow : public GLWindow
+ {
+@@ -70,6 +71,7 @@ void WinOpenGLContext::resetCurrent()
+     OpenGLZone aZone;
+ 
+     wglMakeCurrent(nullptr, nullptr);
++    g_bAnyCurrent = false;
+ }
+ 
+ bool WinOpenGLContext::isCurrent()
+@@ -81,7 +83,7 @@ bool WinOpenGLContext::isCurrent()
+ 
+ bool WinOpenGLContext::isAnyCurrent()
+ {
+-    return wglGetCurrentContext() != nullptr;
++    return g_bAnyCurrent && wglGetCurrentContext() != nullptr;
+ }
+ 
+ void WinOpenGLContext::makeCurrent()
+@@ -95,10 +97,13 @@ void WinOpenGLContext::makeCurrent()
+ 
+     if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC))
+     {
++        g_bAnyCurrent = false;
+         SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << WindowsErrorString(GetLastError()));
+         return;
+     }
+ 
++    g_bAnyCurrent = true;
++
+     registerAsCurrent();
+ }
+ 
+@@ -140,7 +145,10 @@ void WinOpenGLContext::destroyCurrentContext()
+             g_vShareList.erase(itr);
+ 
+         if (wglGetCurrentContext() != nullptr)
++        {
+             wglMakeCurrent(nullptr, nullptr);
++            g_bAnyCurrent = false;
++        }
+         wglDeleteContext( m_aGLWin.hRC );
+         ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC );
+         m_aGLWin.hRC = nullptr;
+@@ -208,11 +216,13 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT
+     if(!ret)
+     {
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(glWin.hRC);
+         ReleaseDC(hwnd, glWin.hDC);
+         DestroyWindow(hwnd);
+         return false;
+     }
++    g_bAnyCurrent = false;
+ 
+     return true;
+ }
+@@ -275,6 +285,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
+     {
+         SAL_WARN("vcl.opengl", "Device doesn't support multisample");
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(glWin.hRC);
+         ReleaseDC(hWnd, glWin.hDC);
+         DestroyWindow(hWnd);
+@@ -285,6 +296,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
+     if (!fn_wglChoosePixelFormatARB)
+     {
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(glWin.hRC);
+         ReleaseDC(hWnd, glWin.hDC);
+         DestroyWindow(hWnd);
+@@ -341,6 +353,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
+         bArbMultisampleSupported = true;
+         rPixelFormat = pixelFormat;
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(glWin.hRC);
+         ReleaseDC(hWnd, glWin.hDC);
+         DestroyWindow(hWnd);
+@@ -355,6 +368,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
+         bArbMultisampleSupported = true;
+         rPixelFormat = pixelFormat;
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(glWin.hRC);
+         ReleaseDC(hWnd, glWin.hDC);
+         DestroyWindow(hWnd);
+@@ -362,6 +376,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
+     }
+     // Return the valid format
+     wglMakeCurrent(nullptr, nullptr);
++    g_bAnyCurrent = false;
+     wglDeleteContext(glWin.hRC);
+     ReleaseDC(hWnd, glWin.hDC);
+     DestroyWindow(hWnd);
+@@ -542,13 +557,17 @@ bool WinOpenGLContext::ImplInit()
+ 
+     if (!wglMakeCurrent(m_aGLWin.hDC, hTempRC))
+     {
++        g_bAnyCurrent = false;
+         SAL_WARN("vcl.opengl", "wglMakeCurrent failed: "<< WindowsErrorString(GetLastError()));
+         return false;
+     }
+ 
+-    if (!InitGLEW())
++    g_bAnyCurrent = true;
++
++    if (!InitGL())
+     {
+         wglMakeCurrent(NULL, NULL);
++        g_bAnyCurrent = false;
+         wglDeleteContext(hTempRC);
+         return false;
+     }
+@@ -560,6 +579,7 @@ bool WinOpenGLContext::ImplInit()
+     if (!wglCreateContextAttribsARB)
+     {
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(hTempRC);
+         return false;
+     }
+@@ -578,6 +598,7 @@ bool WinOpenGLContext::ImplInit()
+     {
+         SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed: "<< WindowsErrorString(GetLastError()));
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(hTempRC);
+         return false;
+     }
+@@ -585,19 +606,24 @@ bool WinOpenGLContext::ImplInit()
+     if (!compiledShaderBinariesWork())
+     {
+         wglMakeCurrent(nullptr, nullptr);
++        g_bAnyCurrent = false;
+         wglDeleteContext(hTempRC);
+         return false;
+     }
+ 
+     wglMakeCurrent(nullptr, nullptr);
++    g_bAnyCurrent = false;
+     wglDeleteContext(hTempRC);
+ 
+     if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC))
+     {
++        g_bAnyCurrent = false;
+         SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << WindowsErrorString(GetLastError()));
+         return false;
+     }
+ 
++    g_bAnyCurrent = true;
++
+     if (bFirstCall)
+     {
+         // Checking texture size
+@@ -629,7 +655,7 @@ bool WinOpenGLContext::ImplInit()
+         }
+     }
+ 
+-    InitGLEWDebugging();
++    InitGLDebugging();
+ 
+     g_vShareList.push_back(m_aGLWin.hRC);
+ 
+diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
+index 82f8bc9..292dd14 100644
+--- a/vcl/opengl/x11/gdiimpl.cxx
++++ b/vcl/opengl/x11/gdiimpl.cxx
+@@ -32,6 +32,7 @@
+ #include <o3tl/lru_map.hxx>
+ 
+ static std::vector<GLXContext> g_vShareList;
++static bool g_bAnyCurrent;
+ 
+ class X11OpenGLContext : public OpenGLContext
+ {
+@@ -184,23 +185,10 @@ namespace
+         return pFBC;
+     }
+ 
+-    // we need them before glew can initialize them
+-    // glew needs an OpenGL context so we need to get the address manually
+-    void initOpenGLFunctionPointers()
+-    {
+-        glXChooseFBConfig = reinterpret_cast<GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXChooseFBConfig")));
+-        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
+-        glXGetFBConfigAttrib = reinterpret_cast<int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value)>(glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("glXGetFBConfigAttrib")));
+-        glXCreateContextAttribsARB = reinterpret_cast<GLXContext(*)(Display*, GLXFBConfig, GLXContext, Bool, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreateContextAttribsARB")));
+-        glXCreatePixmap = reinterpret_cast<GLXPixmap(*)(Display*, GLXFBConfig, Pixmap, const int*)>(glXGetProcAddressARB(reinterpret_cast<const GLubyte *>("glXCreatePixmap")));
+-    }
+-
+     Visual* getVisual(Display* dpy, Window win)
+     {
+         OpenGLZone aZone;
+ 
+-        initOpenGLFunctionPointers();
+-
+         XWindowAttributes xattr;
+         if( !XGetWindowAttributes( dpy, win, &xattr ) )
+         {
+@@ -235,7 +223,10 @@ void X11OpenGLContext::resetCurrent()
+     OpenGLZone aZone;
+ 
+     if (m_aGLWin.dpy)
++    {
+         glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
++        g_bAnyCurrent = false;
++    }
+ }
+ 
+ bool X11OpenGLContext::isCurrent()
+@@ -247,7 +238,7 @@ bool X11OpenGLContext::isCurrent()
+ 
+ bool X11OpenGLContext::isAnyCurrent()
+ {
+-    return glXGetCurrentContext() != None;
++    return g_bAnyCurrent && glXGetCurrentContext() != None;
+ }
+ 
+ SystemWindowData X11OpenGLContext::generateWinData(vcl::Window* pParent, bool /*bRequestLegacyContext*/)
+@@ -266,8 +257,6 @@ SystemWindowData X11OpenGLContext::generateWinData(vcl::Window* pParent, bool /*
+     if( dpy == nullptr || !glXQueryExtension( dpy, nullptr, nullptr ) )
+         return aWinData;
+ 
+-    initOpenGLFunctionPointers();
+-
+     int best_fbc = -1;
+     GLXFBConfig* pFBC = getFBConfig(dpy, win, best_fbc, true, false);
+ 
+@@ -355,10 +344,13 @@ bool X11OpenGLContext::ImplInit()
+ 
+     if( !glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ) )
+     {
++        g_bAnyCurrent = false;
+         SAL_WARN("vcl.opengl", "unable to select current GLX context");
+         return false;
+     }
+ 
++    g_bAnyCurrent = true;
++
+     int glxMinor, glxMajor;
+     double nGLXVersion = 0;
+     if( glXQueryVersion( m_aGLWin.dpy, &glxMajor, &glxMinor ) )
+@@ -400,8 +392,8 @@ bool X11OpenGLContext::ImplInit()
+         }
+     }
+ 
+-    bool bRet = InitGLEW();
+-    InitGLEWDebugging();
++    bool bRet = InitGL();
++    InitGLDebugging();
+ 
+     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ 
+@@ -427,10 +419,12 @@ void X11OpenGLContext::makeCurrent()
+     {
+         if (!glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ))
+         {
++            g_bAnyCurrent = false;
+             SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed "
+                      "on drawable " << m_aGLWin.win);
+             return;
+         }
++        g_bAnyCurrent = true;
+     }
+ 
+     registerAsCurrent();
+@@ -445,6 +439,7 @@ void X11OpenGLContext::destroyCurrentContext()
+             g_vShareList.erase(itr);
+ 
+         glXMakeCurrent(m_aGLWin.dpy, None, nullptr);
++        g_bAnyCurrent = false;
+         if( glGetError() != GL_NO_ERROR )
+         {
+             SAL_WARN("vcl.opengl", "glError: " << glGetError());
+diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx
+index c75f2a7..9e6e746 100644
+--- a/vcl/osx/salobj.cxx
++++ b/vcl/osx/salobj.cxx
+@@ -321,8 +321,8 @@ bool AquaOpenGLContext::ImplInit()
+     NSOpenGLView* pView = getOpenGLView();
+     [[pView openGLContext] makeCurrentContext];
+ 
+-    bool bRet = InitGLEW();
+-    InitGLEWDebugging();
++    bool bRet = InitGL();
++    InitGLDebugging();
+     return bRet;
+ }
+ 
+diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
+index 93bde70..c04a0cf 100644
+--- a/vcl/source/opengl/OpenGLContext.cxx
++++ b/vcl/source/opengl/OpenGLContext.cxx
+@@ -7,7 +7,6 @@
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  */
+ 
+-#include <config_opengl.h>
+ #include <chrono>
+ 
+ #include <vcl/opengl/OpenGLContext.hxx>
+@@ -205,13 +204,8 @@ extern "C" void
+ APIENTRY
+ #endif
+ debug_callback(GLenum source, GLenum type, GLuint id,
+-        GLenum severity, GLsizei , const GLchar* message,
+-#if HAVE_GLEW_1_12
+-        const GLvoid*
+-#else
+-        GLvoid*
+-#endif
+-        )
++               GLenum severity, GLsizei , const GLchar* message,
++               const GLvoid*)
+ {
+     // 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."
+     // the GLSL compiler is a bit too aggressive in optimizing the state based on the current OpenGL state
+@@ -280,30 +274,14 @@ OUString getGLString(GLenum eGlEnum)
+     return sString;
+ }
+ 
+-bool OpenGLContext::InitGLEW()
++bool OpenGLContext::InitGL()
+ {
+-    static bool bGlewInit = false;
+-    if(!bGlewInit)
+-    {
+-        OpenGLZone aZone;
+-
+-        glewExperimental = GL_TRUE;
+-        GLenum err = glewInit();
+-        if (err != GLEW_OK)
+-        {
+-            SAL_WARN("vcl.opengl", "Failed to initialize GLEW: " << glewGetErrorString(err));
+-            return false;
+-        }
+-        else
+-            bGlewInit = true;
+-    }
+-
+     VCL_GL_INFO("OpenGLContext::ImplInit----end");
+     VCL_GL_INFO("Vendor: " << getGLString(GL_VENDOR) << " Renderer: " << getGLString(GL_RENDERER) << " GL version: " << OpenGLHelper::getGLVersion());
+     mbInitialized = true;
+ 
+     // I think we need at least GL 3.0
+-    if (!GLEW_VERSION_3_0)
++    if (epoxy_gl_version() < 30)
+     {
+         SAL_WARN("vcl.opengl", "We don't have at least OpenGL 3.0");
+         return false;
+@@ -319,11 +297,11 @@ bool OpenGLContext::InitGLEW()
+     return true;
+ }
+ 
+-void OpenGLContext::InitGLEWDebugging()
++void OpenGLContext::InitGLDebugging()
+ {
+ #ifdef DBG_UTIL
+     // only enable debug output in dbgutil build
+-    if( GLEW_ARB_debug_output)
++    if (epoxy_has_gl_extension("GL_ARB_debug_output"))
+     {
+         OpenGLZone aZone;
+ 
+diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
+index f07e7dc..9b91415 100644
+--- a/vcl/source/opengl/OpenGLHelper.cxx
++++ b/vcl/source/opengl/OpenGLHelper.cxx
+@@ -401,7 +401,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
+         aGeometryShaderSource = getShaderSource(rGeometryShaderName);
+ 
+     GLint bBinaryResult = GL_FALSE;
+-    if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() )
++    if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty())
+     {
+         OString aFileName =
+                 createFileName(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, rDigest);
+@@ -473,7 +473,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
+     if (bHasGeometryShader)
+         glAttachShader(ProgramID, GeometryShaderID);
+ 
+-    if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() )
++    if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty())
+     {
+         glProgramParameteri(ProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
+         glLinkProgram(ProgramID);
+@@ -1085,14 +1085,14 @@ void OpenGLHelper::debugMsgPrint(const int nType, const char *pFormat, ...)
+     {
+         OpenGLZone aZone;
+ 
+-        if (GLEW_KHR_debug)
++        if (epoxy_has_gl_extension("GL_KHR_debug"))
+             glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION,
+                                  GL_DEBUG_TYPE_OTHER,
+                                  1, // one[sic] id is as good as another ?
+                                  // GL_DEBUG_SEVERITY_NOTIFICATION for >= GL4.3 ?
+                                  GL_DEBUG_SEVERITY_LOW,
+                                  strlen(pStr), pStr);
+-        else if (GLEW_AMD_debug_output)
++        else if (epoxy_has_gl_extension("GL_AMD_debug_output"))
+             glDebugMessageInsertAMD(GL_DEBUG_CATEGORY_APPLICATION_AMD,
+                                     GL_DEBUG_SEVERITY_LOW_AMD,
+                                     1, // one[sic] id is as good as another ?
+diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
+index 0bff9b8..34f0e6f 100644
+--- a/vcl/unx/generic/app/saldisp.cxx
++++ b/vcl/unx/generic/app/saldisp.cxx
+@@ -47,7 +47,6 @@
+ #include <X11/extensions/Xinerama.h>
+ #endif
+ 
+-#include "GL/glxew.h"
+ #include <opengl/zone.hxx>
+ 
+ #include <vcl/svapp.hxx>
+diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
+index ae2973b..32d6ae8 100644
+--- a/vcl/workben/icontest.cxx
++++ b/vcl/workben/icontest.cxx
+@@ -20,8 +20,6 @@
+ 
+ #include <math.h>
+ 
+-#include <GL/glew.h>
+-
+ #include <glm/gtx/bit.hpp>
+ 
+ #include <com/sun/star/lang/XComponent.hpp>
+-- 
+cgit v0.10.2
+
+From b252dbf59dc1466a2ef45e9905334718e587e5c9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 13 Dec 2016 12:23:04 +0000
+Subject: missing EGL/eglplatform.h error -> install mesa-libEGL-devel
+
+Change-Id: I689fd6d4f90dd46b71803517bbe2df73486dc9ec
+
+diff --git a/configure.ac b/configure.ac
+index 18815ad..f19048a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -10431,6 +10431,7 @@ elif test $_os = WINNT; then
+ else
+     if test "$USING_X11" = TRUE; then
+         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
++        AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
+         ENABLE_OPENGL_TRANSITIONS=TRUE
+         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
+         ENABLE_OPENGL_CANVAS=TRUE
+-- 
+cgit v0.10.2
+
+From 54491dce60ddce0cca509d030b0c38093a8be535 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 13 Dec 2016 16:08:14 +0000
+Subject: turn off epoxy egl support by default and enable only when gtk3 is
+ enabled
+
+to build on the festering baseline on which gtk3 is disabled
+
+Change-Id: I6c074382590fc60ae8572fbde225679e4309494e
+
+diff --git a/configure.ac b/configure.ac
+index f19048a..18815ad 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -10431,7 +10431,6 @@ elif test $_os = WINNT; then
+ else
+     if test "$USING_X11" = TRUE; then
+         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
+-        AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
+         ENABLE_OPENGL_TRANSITIONS=TRUE
+         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
+         ENABLE_OPENGL_CANVAS=TRUE
+diff --git a/external/epoxy/Library_epoxy.mk b/external/epoxy/Library_epoxy.mk
+index 28f9dab..10be001 100644
+--- a/external/epoxy/Library_epoxy.mk
++++ b/external/epoxy/Library_epoxy.mk
+@@ -55,9 +55,20 @@ else
+ $(eval $(call gb_Library_add_generated_cobjects,epoxy,\
+ 	UnpackedTarball/epoxy/src/dispatch_glx \
+ 	UnpackedTarball/epoxy/src/glx_generated_dispatch \
++))
++ifeq ($(ENABLE_GTK3),TRUE)
++$(eval $(call gb_Library_add_cflags,epoxy,\
++	-DPLATFORM_HAS_EGL=1 \
++))
++$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
+ 	UnpackedTarball/epoxy/src/dispatch_egl \
+ 	UnpackedTarball/epoxy/src/egl_generated_dispatch \
+ ))
++else
++$(eval $(call gb_Library_add_cflags,epoxy,\
++	-DPLATFORM_HAS_EGL=0 \
++))
++endif
+ endif
+ 
+ # vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/UnpackedTarball_epoxy.mk b/external/epoxy/UnpackedTarball_epoxy.mk
+index 76c0fdf..0d51548 100644
+--- a/external/epoxy/UnpackedTarball_epoxy.mk
++++ b/external/epoxy/UnpackedTarball_epoxy.mk
+@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,epoxy,0))
+ 
+ $(eval $(call gb_UnpackedTarball_add_patches,epoxy, \
+     external/epoxy/epoxy.windows.api.patch \
++    external/epoxy/epoxy.noegl.by.default.patch \
+ ))
+ 
+ # vim: set noet sw=4 ts=4:
+diff --git a/external/epoxy/epoxy.noegl.by.default.patch b/external/epoxy/epoxy.noegl.by.default.patch
+new file mode 100644
+index 0000000..d80a3b9
+--- /dev/null
++++ b/external/epoxy/epoxy.noegl.by.default.patch
+@@ -0,0 +1,11 @@
++--- src/dispatch_common.h
+++++ src/dispatch_common.h
++@@ -39,7 +39,7 @@
++ #define PLATFORM_HAS_WGL 0
++ #define EPOXY_IMPORTEXPORT
++ #else
++-#define PLATFORM_HAS_EGL 1
+++
++ #define PLATFORM_HAS_GLX 1
++ #define PLATFORM_HAS_WGL 0
++ #define EPOXY_IMPORTEXPORT
+-- 
+cgit v0.10.2
+
+From d9aec10456ddc1787a7afe91502b91da616e2b0d Mon Sep 17 00:00:00 2001
+From: Markus Mohrhard <markus.mohrhard at googlemail.com>
+Date: Wed, 14 Dec 2016 07:09:58 +0100
+Subject: check for EGL if we built with GTK3 support
+
+Change-Id: Ib944b8109c734f01ca67783c286c8e10e07a1d25
+Reviewed-on: https://gerrit.libreoffice.org/31993
+Reviewed-by: Michael Stahl <mstahl at redhat.com>
+Tested-by: Michael Stahl <mstahl at redhat.com>
+
+diff --git a/configure.ac b/configure.ac
+index 38a98dd..251d048 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -10106,6 +10106,7 @@ if test "x$enable_gtk3" = "xyes"; then
+     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+     FilterLibs "${GTK3_LIBS}"
+     GTK3_LIBS="${filteredlibs}"
++    AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
+ fi
+ AC_SUBST(GTK3_LIBS)
+ AC_SUBST(GTK3_CFLAGS)
+-- 
+cgit v0.10.2
+
+From 647f149a7413d4b88c5567691909c32ae9449501 Mon Sep 17 00:00:00 2001
+From: Rene Engelhard <rene at debian.org>
+Date: Wed, 14 Dec 2016 22:39:02 +0100
+Subject: only check for libEGL in internal epoxy case
+
+as that TTBOMK is the case where it's used. At least it's not used in
+vcl and slideshow directly
+
+Change-Id: Ie77656e56e0017800bc0107c2bfe63ddc4b5b9a5
+
+diff --git a/configure.ac b/configure.ac
+index 62cb35e..e36dbd4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -10106,7 +10106,6 @@ if test "x$enable_gtk3" = "xyes"; then
+     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+     FilterLibs "${GTK3_LIBS}"
+     GTK3_LIBS="${filteredlibs}"
+-    AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
+ fi
+ AC_SUBST(GTK3_LIBS)
+ AC_SUBST(GTK3_CFLAGS)
+@@ -11700,6 +11699,9 @@ dnl ===================================================================
+ dnl Check for system epoxy
+ dnl ===================================================================
+ libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.3.1], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
++if test "$with_system_epoxy" = "no"; then
++    AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
++fi
+ 
+ dnl ===================================================================
+ dnl Test whether to use avahi
+-- 
+cgit v0.10.2
+
diff --git a/patches/gtk3-opengl-slideshow.diff b/patches/gtk3-opengl-slideshow.diff
index 253087c..173fe35 100644
--- a/patches/gtk3-opengl-slideshow.diff
+++ b/patches/gtk3-opengl-slideshow.diff
@@ -1,97 +1,21 @@
-From 712af05b25bd4fd5343a5622b7a42eff177eeb83 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
-Date: Thu, 1 Dec 2016 12:32:09 +0000
-Subject: [PATCH] rework diamond transition to use only opengl core
-
-cause that's all we've got in gtk3
-
-Change-Id: I6a47e344ccd39ba63e7a51ae18f89bb05bb642c4
----
- .../OGLTrans/generic/OGLTrans_TransitionImpl.cxx   | 28 +++++++++++++++-------
- 1 file changed, 20 insertions(+), 8 deletions(-)
-
-diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
-index 8b508c6..9eb1e51 100644
---- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
-+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
-@@ -317,8 +317,6 @@ OGLTransitionImpl::displayUnbufferedSlide(
-         double SlideWidthScale, double SlideHeightScale )
- {
-     CHECK_GL_ERROR();
--    glPushMatrix();
--    CHECK_GL_ERROR();
-     glBindTexture(GL_TEXTURE_2D, glSlideTex);
-     CHECK_GL_ERROR();
-     glBindVertexArray(0);
-@@ -336,8 +334,6 @@ OGLTransitionImpl::displayUnbufferedSlide(
-     CHECK_GL_ERROR();
-     glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject);
-     CHECK_GL_ERROR();
--    glPopMatrix();
--    CHECK_GL_ERROR();
- }
- 
- void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
-@@ -360,15 +356,31 @@ void Primitive::display(GLint primitiveTransformLocation, double nTime, double W
-         CHECK_GL_ERROR();
-     }
- 
--    glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
-+    GLuint nVertexArrayObject;
-+    glGenVertexArrays(1, &nVertexArrayObject);
-+    CHECK_GL_ERROR();
-+    glBindVertexArray(nVertexArrayObject);
-+    CHECK_GL_ERROR();
-+
-+    GLuint nBuffer;
-+    glGenBuffers(1, &nBuffer);
-     CHECK_GL_ERROR();
--    glEnableClientState( GL_VERTEX_ARRAY );
-+    glBindBuffer(GL_ARRAY_BUFFER, nBuffer);
-     CHECK_GL_ERROR();
--    glVertexPointer( 3, GL_FLOAT, sizeof(Vertex), &Vertices[0] );
-+    glBufferData(GL_ARRAY_BUFFER, getVerticesSize(), Vertices.data(), GL_STATIC_DRAW);
-+
-+    glEnableVertexAttribArray(0);
-+    CHECK_GL_ERROR();
-+    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr);
-+
-     CHECK_GL_ERROR();
-     glDrawArrays( GL_TRIANGLES, 0, getVerticesSize() );
-     CHECK_GL_ERROR();
--    glPopClientAttrib();
-+
-+    glDeleteBuffers(1, &nBuffer);
-+    CHECK_GL_ERROR();
-+
-+    glDeleteVertexArrays(1, &nVertexArrayObject);
- 
-     CHECK_GL_ERROR();
- }
--- 
-2.9.3
-
-From fdc33220c54238850958001b536c8a54bf40f9c1 Mon Sep 17 00:00:00 2001
+From 8bd9db90383ee008777903c35c7a5eb2c5352e71 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
 Date: Fri, 25 Nov 2016 14:11:13 +0000
-Subject: [PATCH] gtk3: implement opengl support for slideshow
+Subject: gtk3: implement opengl support for slideshow
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 all of them work, except "Fall" doesn't look right, but it has
 the exact same problem under gtk2/gen to.
 
 Change-Id: I73cb9c0fb8211f727198be78d90d4f80a4f8c7c8
----
- include/vcl/opengl/OpenGLContext.hxx               |   2 +
- .../OGLTrans/generic/OGLTrans_TransitionImpl.cxx   |  73 ++++++------
- .../OGLTrans/generic/OGLTrans_TransitionImpl.hxx   |   9 +-
- .../OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |   7 +-
- vcl/inc/unx/gtk/gtkinst.hxx                        |   1 +
- vcl/source/opengl/OpenGLContext.cxx                |   5 +
- vcl/unx/gtk3/gtk3gtkinst.cxx                       | 127 +++++++++++++++++++++
- 7 files changed, 181 insertions(+), 43 deletions(-)
+Reviewed-on: https://gerrit.libreoffice.org/31214
+Reviewed-by: Caolán McNamara <caolanm at redhat.com>
+Tested-by: Caolán McNamara <caolanm at redhat.com>
 
 diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
-index 7cd6954..2929006 100644
+index 37d354e..5fc88d6 100644
 --- a/include/vcl/opengl/OpenGLContext.hxx
 +++ b/include/vcl/opengl/OpenGLContext.hxx
 @@ -129,6 +129,8 @@ public:
@@ -103,10 +27,10 @@ index 7cd6954..2929006 100644
      virtual void swapBuffers();
      virtual void sync();
      void show();
-diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
-index 94b2217..f253a07 100644
---- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
-+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
+index 1c69121..e28b17f 100644
+--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
++++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
 @@ -29,6 +29,7 @@
  #include <glm/gtc/matrix_transform.hpp>
  #include <glm/gtc/type_ptr.hpp>
@@ -169,7 +93,7 @@ index 94b2217..f253a07 100644
      CHECK_GL_ERROR();
      displayScene( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
      CHECK_GL_ERROR();
-@@ -536,9 +537,9 @@ public:
+@@ -534,9 +535,9 @@ public:
  
  private:
      virtual GLuint makeShader() const override;
@@ -181,7 +105,7 @@ index 94b2217..f253a07 100644
          glDisable(GL_CULL_FACE);
      }
  
-@@ -553,7 +554,7 @@ GLuint ReflectionTransition::makeShader() const
+@@ -551,7 +552,7 @@ GLuint ReflectionTransition::makeShader() const
  }
  
  void ReflectionTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
@@ -190,7 +114,7 @@ index 94b2217..f253a07 100644
  {
      CHECK_GL_ERROR();
      applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-@@ -601,7 +602,7 @@ public:
+@@ -598,7 +599,7 @@ public:
  private:
      virtual GLuint makeShader() const override;
  
@@ -199,7 +123,7 @@ index 94b2217..f253a07 100644
  };
  
  GLuint SimpleTransition::makeShader() const
-@@ -610,7 +611,7 @@ GLuint SimpleTransition::makeShader() const
+@@ -607,7 +608,7 @@ GLuint SimpleTransition::makeShader() const
  }
  
  void SimpleTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
@@ -208,7 +132,7 @@ index 94b2217..f253a07 100644
  {
      CHECK_GL_ERROR();
      applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-@@ -860,10 +861,10 @@ public:
+@@ -857,10 +858,10 @@ public:
      {}
  
  private:
@@ -221,23 +145,25 @@ index 94b2217..f253a07 100644
  {
      applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
  
-@@ -1198,13 +1199,13 @@ public:
+@@ -1195,7 +1196,7 @@ public:
          {}
  
  private:
 -    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
 +    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale, OpenGLContext *pContext ) override;
- 
-     Primitives_t makeLeavingSlide(double nTime) const;
  };
  
+ Primitives_t makeLeavingSlide(double nTime)
+@@ -1229,7 +1230,7 @@ Primitives_t makeLeavingSlide(double nTime)
+ }
+ 
  void DiamondTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
 -                                              double SlideWidthScale, double SlideHeightScale )
 +                                        double SlideWidthScale, double SlideHeightScale, OpenGLContext * )
  {
      CHECK_GL_ERROR();
      applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-@@ -1416,7 +1417,7 @@ protected:
+@@ -1411,7 +1412,7 @@ protected:
      {}
  
      virtual void finishTransition() override;
@@ -246,7 +172,7 @@ index 94b2217..f253a07 100644
  
  private:
      /** various data */
-@@ -1493,7 +1494,7 @@ void initPermTexture(GLuint *texID)
+@@ -1488,7 +1489,7 @@ void initPermTexture(GLuint *texID)
      CHECK_GL_ERROR();
  }
  
@@ -255,7 +181,7 @@ index 94b2217..f253a07 100644
  {
      CHECK_GL_ERROR();
      GLint location = glGetUniformLocation( m_nProgramObject, "permTexture" );
-@@ -1634,8 +1635,8 @@ public:
+@@ -1629,8 +1630,8 @@ public:
  private:
      virtual void finishTransition() override;
      virtual GLuint makeShader() const override;
@@ -266,7 +192,7 @@ index 94b2217..f253a07 100644
  
      GLint mnSlideLocation = -1;
      GLint mnTileInfoLocation = -1;
-@@ -1684,10 +1685,10 @@ glm::mat4 lookAt(const glm::vec3& eye, const glm::vec3& center, const glm::vec3&
+@@ -1679,10 +1680,10 @@ glm::mat4 lookAt(const glm::vec3& eye, const glm::vec3& center, const glm::vec3&
                       -glm::dot(s, eye), -glm::dot(u, eye), glm::dot(f, eye), 1);
  }
  
@@ -279,7 +205,7 @@ index 94b2217..f253a07 100644
      CHECK_GL_ERROR();
  
      mnSlideLocation = glGetUniformLocation(m_nProgramObject, "slide");
-@@ -1788,7 +1789,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
+@@ -1783,7 +1784,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
          }
      }
  
@@ -288,7 +214,7 @@ index 94b2217..f253a07 100644
      glBindTexture(GL_TEXTURE_2D, 0);
  
      glActiveTexture( GL_TEXTURE2 );
-@@ -1798,7 +1799,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
+@@ -1793,7 +1794,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
      glActiveTexture( GL_TEXTURE0 );
  }
  
@@ -297,7 +223,7 @@ index 94b2217..f253a07 100644
  {
      CHECK_GL_ERROR();
      applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-@@ -1820,7 +1821,7 @@ void VortexTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex
+@@ -1815,7 +1816,7 @@ void VortexTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex
      displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
  
      glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
@@ -306,7 +232,7 @@ index 94b2217..f253a07 100644
      glUniform1f( mnShadowLocation, 0.0 );
      glUniform1f( mnSlideLocation, 0.0 );
      displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
-@@ -1882,7 +1883,7 @@ public:
+@@ -1877,7 +1878,7 @@ public:
  
  private:
      virtual GLuint makeShader() const override;
@@ -315,7 +241,7 @@ index 94b2217..f253a07 100644
      virtual void prepare( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) override;
  
      glm::vec2 maCenter;
-@@ -1894,7 +1895,7 @@ GLuint RippleTransition::makeShader() const
+@@ -1889,7 +1890,7 @@ GLuint RippleTransition::makeShader() const
      return OpenGLHelper::LoadShaders( "basicVertexShader", "rippleFragmentShader" );
  }
  
@@ -324,7 +250,7 @@ index 94b2217..f253a07 100644
  {
      GLint nCenterLocation = glGetUniformLocation(m_nProgramObject, "center");
      CHECK_GL_ERROR();
-@@ -1979,7 +1980,7 @@ public:
+@@ -1974,7 +1975,7 @@ public:
  
  private:
      virtual GLuint makeShader() const override;
@@ -333,7 +259,7 @@ index 94b2217..f253a07 100644
      virtual void finish( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) override;
  
      GLuint maBuffer = 0;
-@@ -1995,10 +1996,10 @@ struct ThreeFloats
+@@ -1990,10 +1991,10 @@ struct ThreeFloats
      GLfloat x, y, z;
  };
  
@@ -346,7 +272,7 @@ index 94b2217..f253a07 100644
      CHECK_GL_ERROR();
  
      GLint nNumTilesLocation = glGetUniformLocation(m_nProgramObject, "numTiles");
-@@ -2083,8 +2084,8 @@ public:
+@@ -2077,8 +2078,8 @@ public:
  private:
      virtual void finishTransition() override;
      virtual GLuint makeShader() const override;
@@ -357,7 +283,7 @@ index 94b2217..f253a07 100644
  
      GLint maHexagonSizeLocation = -1;
      GLint maSelectedTextureLocation = -1;
-@@ -2117,10 +2118,10 @@ GLuint HoneycombTransition::makeShader() const
+@@ -2111,10 +2112,10 @@ GLuint HoneycombTransition::makeShader() const
      return OpenGLHelper::LoadShaders( "honeycombVertexShader", "honeycombFragmentShader", "honeycombGeometryShader" );
  }
  
@@ -370,7 +296,7 @@ index 94b2217..f253a07 100644
  
      CHECK_GL_ERROR();
      maHexagonSizeLocation = glGetUniformLocation(m_nProgramObject, "hexagonSize");
-@@ -2194,11 +2195,11 @@ void HoneycombTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_In
+@@ -2188,11 +2189,11 @@ void HoneycombTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_In
          return;
      }
  
@@ -384,7 +310,7 @@ index 94b2217..f253a07 100644
  {
      CHECK_GL_ERROR();
      applyOverallOperations(nTime, SlideWidthScale, SlideHeightScale);
-@@ -2222,7 +2223,7 @@ void HoneycombTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlide
+@@ -2216,7 +2217,7 @@ void HoneycombTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlide
  
      // The back (entering) slide needs to be drawn before the front (leaving) one in order for blending to work.
      glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
@@ -393,11 +319,11 @@ index 94b2217..f253a07 100644
      glUniform1f(mnShadowLocation, 0.0);
      glUniform1f(maSelectedTextureLocation, 0.0);
      glUniform1f(maHexagonSizeLocation, 1.0f - borderSize);
-diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
-index fe6a1c5..81288db 100644
---- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
-+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
-@@ -35,6 +35,7 @@
+diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx
+index 6f2e164..a7b2b42 100644
+--- a/slideshow/source/engine/opengl/TransitionImpl.hxx
++++ b/slideshow/source/engine/opengl/TransitionImpl.hxx
+@@ -36,6 +36,7 @@
  #include <vector>
  
  class Primitive;
@@ -405,7 +331,7 @@ index fe6a1c5..81288db 100644
  class Operation;
  class SceneObject;
  class TransitionData;
-@@ -139,10 +140,10 @@ public:
+@@ -136,10 +137,10 @@ public:
  
      /** Prepare transition.
        */
@@ -418,7 +344,7 @@ index fe6a1c5..81288db 100644
      /** Clean up after transition.
        */
      void finish();
-@@ -185,7 +186,7 @@ private:
+@@ -182,7 +183,7 @@ private:
        *
        * Default implementation does nothing.
        */
@@ -427,7 +353,7 @@ index fe6a1c5..81288db 100644
  
      /** This function is called when the transition needs to clear after itself, like delete own textures etc.
        *
-@@ -198,7 +199,7 @@ private:
+@@ -195,7 +196,7 @@ private:
        * Default implementation applies overall operations and then
        * displays both slides.
        */
@@ -436,11 +362,11 @@ index fe6a1c5..81288db 100644
  
      /** This function is called in prepare method to create the GL program.
        *
-diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
-index 266228c..67de19b 100644
---- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
-+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
-@@ -408,7 +408,7 @@ void OGLTransitionerImpl::impl_prepareSlides()
+diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
+index 01cd3e5..f2f0b3f 100644
+--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
++++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
+@@ -407,7 +407,7 @@ void OGLTransitionerImpl::impl_prepareSlides()
  bool OGLTransitionerImpl::impl_prepareTransition()
  {
      if( mpTransition && mpTransition->getSettings().mnRequiredGLVersion <= mnGLVersion )
@@ -449,7 +375,7 @@ index 266228c..67de19b 100644
      return false;
  }
  
-@@ -1053,10 +1053,11 @@ void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeExc
+@@ -1046,10 +1046,11 @@ void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeExc
      CHECK_GL_ERROR();
  
      const GLWindow& rGLWindow(mpContext->getOpenGLWindow());
@@ -464,10 +390,10 @@ index 266228c..67de19b 100644
      mpContext->swapBuffers();
  
 diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
-index 941fa4a..6e114d1 100644
+index 514b13f..e20ca9d 100644
 --- a/vcl/inc/unx/gtk/gtkinst.hxx
 +++ b/vcl/inc/unx/gtk/gtkinst.hxx
-@@ -236,6 +236,7 @@ public:
+@@ -239,6 +239,7 @@ public:
      virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
      virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override;
      virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override;
@@ -476,10 +402,10 @@ index 941fa4a..6e114d1 100644
  
      virtual const cairo_font_options_t* GetCairoFontOptions() override;
 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
-index 2412191..0e2a48d 100644
+index c04a0cf..743107b 100644
 --- a/vcl/source/opengl/OpenGLContext.cxx
 +++ b/vcl/source/opengl/OpenGLContext.cxx
-@@ -313,6 +313,11 @@ void OpenGLContext::InitGLDebugging()
+@@ -330,6 +330,11 @@ void OpenGLContext::InitGLDebugging()
  #endif
  }
  
@@ -492,7 +418,7 @@ index 2412191..0e2a48d 100644
  {
      if(m_xWindow)
 diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
-index 7202b468..7bb8adb 100644
+index 7148882..947bcc9 100644
 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx
 +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
 @@ -916,4 +916,131 @@ Reference< XInterface > GtkInstance::CreateDragSource()
@@ -628,5 +554,5 @@ index 7202b468..7bb8adb 100644
 +
  /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 -- 
-2.9.3
+cgit v0.10.2
 
diff --git a/patches/series b/patches/series
index c1a0d19..fa0452f 100644
--- a/patches/series
+++ b/patches/series
@@ -31,4 +31,5 @@ no-packagekit-per-default.diff
 system-officeotron-and-odfvalidator.diff
 no-openssl.diff
 m68k-alignment.diff
+change-from-glew-to-epoxy.diff
 gtk3-opengl-slideshow.diff
diff --git a/rules b/rules
index ffa22ca..4b27f6d 100755
--- a/rules
+++ b/rules
@@ -95,7 +95,6 @@ BUILD_DEPS=\
     libcups2-dev,\
     libfontconfig1-dev,\
     libfreetype6-dev (>= 2.2.0),\
-    libgl1-mesa-dev,\
     libice-dev,\
     libsm-dev,\
     libx11-dev,\
@@ -327,14 +326,10 @@ SUITESPARSE_MIN_VERSION= (>= 1:3.4.0)
 PARALLEL_BUILD=y
 ENABLE_LDAP=y
 USE_OPENLDAP=y
-SYSTEM_STUFF += glew
+SYSTEM_STUFF += epoxy
 ENABLE_GLTF=y
-SYSTEM_STUFF += libgltf
-ifeq "$(shell dpkg --compare-versions $(SYSTEM_GCC_VERSION) ge 5 && echo true)" "true"
-LIBGLTF_MINVER=0.0.2-4
-else
-LIBGLTF_MINVER=0.0.1
-endif
+#SYSTEM_STUFF += libgltf
+LIBGLTF_MINVER=0.1.0
 # I think we should only enable it when we have BOTH system-opencollasa
 # and system-collada2gltf working
 ifeq "$(ENABLE_GLTF)" "y"
@@ -679,7 +674,7 @@ endif
 # Debian Stretch
 ifeq "$(shell dpkg-parsechangelog | grep Distribution | awk '{ print $$2 }')" "stretch-backports"
   BUGS=mailto:debian-backports at lists.debian.org
-  SYSTEM_STUFF := $(filter-out libzmf libstaroffice orcus,$(SYSTEM_STUFF))
+  SYSTEM_STUFF := $(filter-out libzmf libstaroffice orcus libgltf,$(SYSTEM_STUFF))
   STRETCH_BACKPORT=y
 endif
 ifeq "$(shell dpkg-parsechangelog | grep Distribution | awk '{ print $$2 }')" "UNRELEASED"
@@ -1271,6 +1266,9 @@ ifeq "$(BUILD_GTK3)" "y"
   ifneq (cairo,$(findstring cairo,$(SYSTEM_STUFF)))
   $(error GTK3 build fails without system-cairo!!)
   endif
+  ifeq (,$(filter epoxy, $(SYSTEM_STUFF)))
+       BUILD_DEPS += , libegl1-mesa-dev
+  endif
 	GNOME_GTK_RECOMMENDS += libreoffice-gtk3
   ifeq "$(ENABLE_INTROSPECTION)" "y"
 	BUILD_DEPS += , gobject-introspection (>= 1.32.0), libgirepository1.0-dev (>= 1.32)
@@ -1433,8 +1431,8 @@ ifneq (,$(filter redland, $(SYSTEM_STUFF)))
 	SHLIBS_OVERRIDE += -Xunordf
 endif
 
-ifneq (,$(filter glew, $(SYSTEM_STUFF)))
-	BUILD_DEPS += , libglew-dev
+ifneq (,$(filter epoxy, $(SYSTEM_STUFF)))
+	BUILD_DEPS += , libepoxy-dev (>= 1.3.1)
 endif
 ifneq (,$(filter glm, $(SYSTEM_STUFF)))
 	BUILD_DEPS += , libglm-dev (>= 0.9.6.3)
@@ -3198,9 +3196,6 @@ endif
 ifeq (,$(filter libstaroffice, $(SYSTEM_STUFF)))
 	cat debian/shlibs.override.libstaroffice >> debian/shlibs.local
 endif
-ifeq (,$(filter glew, $(SYSTEM_STUFF)))
-	cat debian/shlibs.override.glew >> debian/shlibs.local
-endif
 ifeq (,$(filter orcus, $(SYSTEM_STUFF)))
 	cat debian/shlibs.override.orcus >> debian/shlibs.local
 endif
diff --git a/shlibs.override.glew b/shlibs.override.glew
deleted file mode 100644
index ab81b27..0000000
--- a/shlibs.override.glew
+++ /dev/null
@@ -1 +0,0 @@
-libGLEW		1.10
diff --git a/tests/control b/tests/control
index cbc2773..6c74e1f 100644
--- a/tests/control
+++ b/tests/control
@@ -1,5 +1,5 @@
 Tests: junit-subsequentcheck
-Depends: libreoffice, libreoffice-subsequentcheckbase, libreoffice-sdbc-hsqldb, autoconf, automake, bc, bison, bzip2, fastjar, flex (>= 2.3.35), gperf, libcups2-dev, libfontconfig1-dev, libfreetype6-dev (>= 2.2.0), libgl1-mesa-dev, libice-dev, libsm-dev, libx11-dev, libxaw7-dev, libxext-dev, libxinerama-dev, libxkbfile-dev, libxrender-dev, libxt-dev, libxtst-dev, pkg-config, unzip, x11proto-render-dev, xsltproc, zip, zlib1g-dev , libgltf-dev (>= 0.0.2-4) , opencollada-dev (>= 0.1.0~20140 [...]
+Depends: libreoffice, libreoffice-subsequentcheckbase, libreoffice-sdbc-hsqldb, autoconf, automake, bc, bison, bzip2, fastjar, flex (>= 2.3.35), gperf, libcups2-dev, libfontconfig1-dev, libfreetype6-dev (>= 2.2.0), libice-dev, libsm-dev, libx11-dev, libxaw7-dev, libxext-dev, libxinerama-dev, libxkbfile-dev, libxrender-dev, libxt-dev, libxtst-dev, pkg-config, unzip, x11proto-render-dev, xsltproc, zip, zlib1g-dev , opencollada-dev (>= 0.1.0~20140703.ddf8f47+dfsg1-2) , libpcre3-dev , libcol [...]
 
 Tests: pyuno-import
 Depends: python3-uno

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/libreoffice.git



More information about the Pkg-openoffice-commits mailing list