From c7590d9f255e1efd3dc528e1052f997f4f477009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Jul 2010 11:08:49 +0200 Subject: cleaning up QOpenKODEWindow --- src/plugins/platforms/openkode/qopenkodewindow.cpp | 35 +++++++--------------- src/plugins/platforms/openkode/qopenkodewindow.h | 2 ++ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index e40783f..52117ad 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -77,17 +77,17 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGL_TRANSPARENT_TYPE, EGL_NONE, EGL_NONE }; - EGLint contextAttrs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG - EGL_NONE - }; + + m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + m_eglContextAttrs.append(2); + m_eglContextAttrs.append(EGL_NONE); // m_eglWindowAttrs.append(EGL_RENDER_BUFFER); // m_eglWindowAttrs.append(EGL_BACK_BUFFER); m_eglWindowAttrs.append(EGL_NONE); - EGLenum eglApi = EGL_OPENGL_ES_API; - eglBindAPI(eglApi); + m_eglApi = EGL_OPENGL_ES_API; + eglBindAPI(m_eglApi); QList screens = QApplicationPrivate::platformIntegration()->screens(); //XXXX: jl figure out how to pick the correct screen. @@ -162,7 +162,8 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig, + m_eglContextAttrs.data(), surface, m_eglApi); } QOpenKODEWindow::~QOpenKODEWindow() @@ -191,28 +192,14 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) } } + //need to recreate context delete m_platformGlContext; - /********####neeeds cleaning up **********/ QList screens = QApplicationPrivate::platformIntegration()->screens(); - //XXXX: jl figure out how to pick the correct screen. -// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); -// QOpenKODEScreen *screen = qobject_cast(screens.at(tlw->d_func()->screenNumber)); QOpenKODEScreen *screen = qobject_cast(screens.at(0)); - - EGLint contextAttrs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG - EGL_NONE - }; - - EGLenum eglApi = EGL_OPENGL_ES_API; - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - - qDebug() << "surface id " << surface; - - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); - /*******************************************/ + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, + m_eglContextAttrs.data(),surface,m_eglApi); } void QOpenKODEWindow::setVisible(bool visible) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 04fa70a..51252a9 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -66,6 +66,8 @@ private: EGLNativeWindowType m_eglWindow; EGLConfig m_eglConfig; QVector m_eglWindowAttrs; + QVector m_eglContextAttrs; + EGLenum m_eglApi; QEGLPlatformContext *m_platformGlContext; }; -- cgit v0.12