equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtOpenGL module of the Qt Toolkit. |
7 ** This file is part of the QtOpenGL module of the Qt Toolkit. |
8 ** |
8 ** |
93 #ifndef QGLCMAP_H |
93 #ifndef QGLCMAP_H |
94 #define QGLCMAP_H |
94 #define QGLCMAP_H |
95 |
95 |
96 #include <qcolor.h> |
96 #include <qcolor.h> |
97 |
97 |
98 |
98 /* |
99 |
99 QGLTemporaryContext implementation |
|
100 */ |
|
101 |
|
102 class QGLTemporaryContextPrivate |
|
103 { |
|
104 public: |
|
105 QGLWidget *widget; |
|
106 }; |
|
107 |
|
108 QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) |
|
109 : d(new QGLTemporaryContextPrivate) |
|
110 { |
|
111 d->widget = new QGLWidget; |
|
112 d->widget->makeCurrent(); |
|
113 } |
|
114 |
|
115 QGLTemporaryContext::~QGLTemporaryContext() |
|
116 { |
|
117 delete d->widget; |
|
118 } |
100 |
119 |
101 /***************************************************************************** |
120 /***************************************************************************** |
102 QGLFormat Win32/WGL-specific code |
121 QGLFormat Win32/WGL-specific code |
103 *****************************************************************************/ |
122 *****************************************************************************/ |
104 |
123 |
625 free(lpal); |
644 free(lpal); |
626 d->updateColormap(); |
645 d->updateColormap(); |
627 } |
646 } |
628 } |
647 } |
629 |
648 |
630 void QGLExtensions::init() |
|
631 { |
|
632 static bool init_done = false; |
|
633 |
|
634 if (init_done) |
|
635 return; |
|
636 init_done = true; |
|
637 |
|
638 // We need a context current to initialize the extensions. |
|
639 QGLWidget tmpWidget; |
|
640 tmpWidget.makeCurrent(); |
|
641 |
|
642 init_extensions(); |
|
643 |
|
644 tmpWidget.doneCurrent(); |
|
645 } |
|
646 |
|
647 QT_END_NAMESPACE |
649 QT_END_NAMESPACE |