From 7f8dc9d00c02e0e28cdea92cac8f8e4379bed68b Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 13 Jun 2016 14:52:45 +0200 Subject: Fix build of textureprovider example with -opengl dynamic Do not link to OpenGL calls directly. Instead, use QOpenGLFunctions. Task-number: QTBUG-53841 Change-Id: Ic87bb78fede1ee9f75b81247406ad858b2bf7342 Reviewed-by: Laszlo Agocs --- examples/quick/textureprovider/etcprovider.cpp | 8 +++++--- examples/quick/textureprovider/etcprovider.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp index 7eff597a43..b9bef84f70 100644 --- a/examples/quick/textureprovider/etcprovider.cpp +++ b/examples/quick/textureprovider/etcprovider.cpp @@ -81,7 +81,7 @@ unsigned short getPaddedHeight(ETCHeader *pHeader) EtcTexture::EtcTexture() : m_texture_id(0), m_uploaded(false) { - + initializeOpenGLFunctions(); } EtcTexture::~EtcTexture() @@ -92,8 +92,10 @@ EtcTexture::~EtcTexture() int EtcTexture::textureId() const { - if (m_texture_id == 0) - glGenTextures(1, &const_cast(this)->m_texture_id); + if (m_texture_id == 0) { + EtcTexture *texture = const_cast(this); + texture->glGenTextures(1, &texture->m_texture_id); + } return m_texture_id; } diff --git a/examples/quick/textureprovider/etcprovider.h b/examples/quick/textureprovider/etcprovider.h index a9ec5ed606..e9761e3629 100644 --- a/examples/quick/textureprovider/etcprovider.h +++ b/examples/quick/textureprovider/etcprovider.h @@ -34,7 +34,7 @@ #ifndef ETCPROVIDER_H #define ETCPROVIDER_H -#include +#include #include #include #include @@ -54,7 +54,7 @@ private: QUrl m_baseUrl; }; -class EtcTexture : public QSGTexture +class EtcTexture : public QSGTexture, protected QOpenGLFunctions { Q_OBJECT public: -- cgit v1.2.3