src/opengl/qgl_qws.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 7 3f74d0d4af4c
--- a/src/opengl/qgl_qws.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/opengl/qgl_qws.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -83,6 +83,28 @@
         return 0;
 }
 
+/*
+    QGLTemporaryContext implementation
+*/
+
+class QGLTemporaryContextPrivate
+{
+public:
+    QGLWidget *widget;
+};
+
+QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
+    : d(new QGLTemporaryContextPrivate)
+{
+    d->widget = new QGLWidget;
+    d->widget->makeCurrent();
+}
+
+QGLTemporaryContext::~QGLTemporaryContext()
+{
+    delete d->widget;
+}
+
 /*****************************************************************************
   QOpenGL debug facilities
  *****************************************************************************/
@@ -311,36 +333,4 @@
 {
 }
 
-void QGLExtensions::init()
-{
-    static bool init_done = false;
-
-    if (init_done)
-        return;
-    init_done = true;
-
-    // We need a context current to initialize the extensions,
-    // but getting a valid EGLNativeWindowType this early can be
-    // problematic under QWS.  So use a pbuffer instead.
-    //
-    // Unfortunately OpenGL/ES 2.0 systems don't normally
-    // support pbuffers, so we have no choice but to try
-    // our luck with a window on those systems.
-#if defined(QT_OPENGL_ES_2)
-    QGLWidget tmpWidget;
-    tmpWidget.makeCurrent();
-
-    init_extensions();
-
-    tmpWidget.doneCurrent();
-#else
-    QGLPixelBuffer pbuffer(16, 16);
-    pbuffer.makeCurrent();
-
-    init_extensions();
-
-    pbuffer.doneCurrent();
-#endif
-}
-
 QT_END_NAMESPACE