summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-25 20:25:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-12-13 11:33:18 +0000
commit482d7ce61b423600b41b459eb26a2cc221cd0acf (patch)
tree8da6edb8200889d93f0b344e61ed779c037a590f /vcl
parent178e38dd82a2cffb2db747c7be82ba7a48338968 (diff)
change from glew to epoxy
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/CppunitTest_vcl_bitmap_test.mk2
-rw-r--r--vcl/CppunitTest_vcl_wmf_test.mk4
-rw-r--r--vcl/Executable_icontest.mk2
-rw-r--r--vcl/Executable_vcldemo.mk2
-rw-r--r--vcl/Executable_visualbackendtest.mk1
-rw-r--r--vcl/Library_vcl.mk3
-rw-r--r--vcl/Library_vclplug_gen.mk3
-rw-r--r--vcl/Library_vclplug_gtk.mk2
-rw-r--r--vcl/Library_vclplug_gtk3.mk2
-rw-r--r--vcl/Library_vclplug_kde4.mk2
-rw-r--r--vcl/inc/opengl/LineRenderUtils.hxx1
-rw-r--r--vcl/inc/opengl/VertexUtils.hxx2
-rw-r--r--vcl/inc/opengl/framebuffer.hxx1
-rw-r--r--vcl/inc/opengl/program.hxx1
-rw-r--r--vcl/inc/opengl/texture.hxx2
-rw-r--r--vcl/inc/pch/precompiled_vcl.hxx2
-rw-r--r--vcl/inc/unx/saldisp.hxx2
-rw-r--r--vcl/opengl/win/gdiimpl.cxx34
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx31
-rw-r--r--vcl/osx/salobj.cxx4
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx34
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx8
-rw-r--r--vcl/unx/generic/app/saldisp.cxx1
-rw-r--r--vcl/workben/icontest.cxx2
24 files changed, 68 insertions, 80 deletions
diff --git a/vcl/CppunitTest_vcl_bitmap_test.mk b/vcl/CppunitTest_vcl_bitmap_test.mk
index 879c7ac5eaa9..70ce156889dc 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 369c79254aff..7cae3639cd0c 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 102697b0daa2..cce8feb48a20 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 bff091e2afeb..a09d3b4936e1 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 abf8cbe1429b..87044535f03e 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 1aae3d719a7b..ebffb7c64695 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
@@ -621,7 +621,6 @@ ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
$(eval $(call gb_Library_add_libs,vcl,\
-lm $(DLOPEN_LIBS) \
-lpthread \
- -lGL \
-lX11 \
-lXext \
))
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index f281605d6bd7..0e1c39c15766 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 c32a127e6b17..67247b73d642 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 8d013d93e369..1457c1abcf9f 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 30c406961427..acd7bd5981da 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 58ae6a809104..e3f375bb3dce 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 f9804ecd978f..de2c070abcc9 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 ec7a45099df7..a2dbd1e63282 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 73cdb7fda6e7..4632ddf44444 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 a0c80295f226..fd4eb9724648 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 235bb911218f..7d3297788219 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 64998df08332..339ba806d6e8 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 1704a19a7234..0d0159d25500 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 82f8bc9f14bd..292dd14e7318 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 c75f2a7d866b..9e6e746d5b35 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 93bde70bcdf7..c04a0cf0c7fc 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 f07e7dcbfa8e..9b91415d2392 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 0bff9b8352c1..34f0e6f73968 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 ae2973b7feef..32d6ae8c05fe 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>