author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 7 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QEGL_P_H |
|
43 |
#define QEGL_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists for the convenience of |
|
50 |
// the QtOpenGL and QtOpenVG modules. This header file may change from |
|
51 |
// version to version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include <QtCore/qsize.h> |
|
57 |
#include <QtGui/qimage.h> |
|
58 |
||
59 |
#include <private/qeglproperties_p.h> |
|
60 |
||
61 |
QT_BEGIN_INCLUDE_NAMESPACE |
|
62 |
||
63 |
#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED) |
|
64 |
#undef EGLNativeWindowType |
|
65 |
#undef EGLNativePixmapType |
|
66 |
#undef EGLNativeDisplayType |
|
67 |
typedef NativeWindowType EGLNativeWindowType; |
|
68 |
typedef NativePixmapType EGLNativePixmapType; |
|
69 |
typedef NativeDisplayType EGLNativeDisplayType; |
|
70 |
#define QEGL_NATIVE_TYPES_DEFINED 1 |
|
71 |
#endif |
|
72 |
QT_END_INCLUDE_NAMESPACE |
|
73 |
||
74 |
QT_BEGIN_NAMESPACE |
|
75 |
||
76 |
class Q_GUI_EXPORT QEglContext |
|
77 |
{ |
|
78 |
public: |
|
79 |
QEglContext(); |
|
80 |
~QEglContext(); |
|
81 |
||
82 |
bool isValid() const; |
|
83 |
bool isCurrent() const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
bool isSharing() const { return sharing; } |
0 | 85 |
|
86 |
QEgl::API api() const { return apiType; } |
|
87 |
void setApi(QEgl::API api) { apiType = api; } |
|
88 |
||
89 |
bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat); |
|
90 |
bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0); |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
91 |
void destroyContext(); |
0 | 92 |
EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0); |
93 |
void destroySurface(EGLSurface surface); |
|
94 |
||
95 |
bool makeCurrent(EGLSurface surface); |
|
96 |
bool doneCurrent(); |
|
97 |
bool lazyDoneCurrent(); |
|
98 |
bool swapBuffers(EGLSurface surface); |
|
99 |
||
100 |
void waitNative(); |
|
101 |
void waitClient(); |
|
102 |
||
103 |
bool configAttrib(int name, EGLint *value) const; |
|
104 |
||
105 |
static void clearError() { eglGetError(); } |
|
106 |
static EGLint error() { return eglGetError(); } |
|
107 |
static QString errorString(EGLint code); |
|
108 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
109 |
static EGLDisplay display(); |
0 | 110 |
|
111 |
EGLContext context() const { return ctx; } |
|
112 |
void setContext(EGLContext context) { ctx = context; ownsContext = false;} |
|
113 |
||
114 |
EGLConfig config() const { return cfg; } |
|
115 |
void setConfig(EGLConfig config) { cfg = config; } |
|
116 |
||
117 |
QEglProperties configProperties(EGLConfig cfg = 0) const; |
|
118 |
||
119 |
void dumpAllConfigs(); |
|
120 |
||
121 |
static QString extensions(); |
|
122 |
static bool hasExtension(const char* extensionName); |
|
123 |
||
124 |
private: |
|
125 |
QEgl::API apiType; |
|
126 |
EGLContext ctx; |
|
127 |
EGLConfig cfg; |
|
128 |
EGLSurface currentSurface; |
|
129 |
bool current; |
|
130 |
bool ownsContext; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
bool sharing; |
0 | 132 |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
133 |
static EGLDisplay dpy; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
134 |
static EGLNativeDisplayType nativeDisplay(); |
0 | 135 |
|
136 |
static QEglContext *currentContext(QEgl::API api); |
|
137 |
static void setCurrentContext(QEgl::API api, QEglContext *context); |
|
138 |
}; |
|
139 |
||
140 |
QT_END_NAMESPACE |
|
141 |
||
142 |
#endif // QEGL_P_H |