author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
** All rights reserved. |
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtOpenGL 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 QGL_H |
|
43 |
#define QGL_H |
|
44 |
||
45 |
#include <QtGui/qwidget.h> |
|
46 |
#include <QtGui/qpaintengine.h> |
|
47 |
#include <QtOpenGL/qglcolormap.h> |
|
48 |
#include <QtCore/qmap.h> |
|
49 |
#include <QtCore/qscopedpointer.h> |
|
50 |
||
51 |
QT_BEGIN_HEADER |
|
52 |
||
53 |
#if defined(Q_WS_WIN) |
|
54 |
# include <QtCore/qt_windows.h> |
|
55 |
#endif |
|
56 |
||
57 |
#if defined(Q_WS_MAC) |
|
58 |
# include <OpenGL/gl.h> |
|
59 |
# include <OpenGL/glu.h> |
|
60 |
#elif defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) |
|
61 |
# include <GLES/gl.h> |
|
62 |
#ifndef GL_DOUBLE |
|
63 |
# define GL_DOUBLE GL_FLOAT |
|
64 |
#endif |
|
65 |
#ifndef GLdouble |
|
66 |
typedef GLfloat GLdouble; |
|
67 |
#endif |
|
68 |
#elif defined(QT_OPENGL_ES_2) |
|
69 |
# include <GLES2/gl2.h> |
|
70 |
#ifndef GL_DOUBLE |
|
71 |
# define GL_DOUBLE GL_FLOAT |
|
72 |
#endif |
|
73 |
#ifndef GLdouble |
|
74 |
typedef GLfloat GLdouble; |
|
75 |
#endif |
|
76 |
#else |
|
77 |
# include <GL/gl.h> |
|
78 |
# ifndef QT_LINUXBASE |
|
79 |
# include <GL/glu.h> |
|
80 |
# endif |
|
81 |
#endif |
|
82 |
||
83 |
QT_BEGIN_NAMESPACE |
|
84 |
||
85 |
QT_MODULE(OpenGL) |
|
86 |
||
87 |
#if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA) && !defined(QDOC) |
|
88 |
#define Q_MAC_COMPAT_GL_FUNCTIONS |
|
89 |
||
90 |
template <typename T> |
|
91 |
struct QMacGLCompatTypes |
|
92 |
{ |
|
93 |
typedef long CompatGLint; |
|
94 |
typedef unsigned long CompatGLuint; |
|
95 |
typedef unsigned long CompatGLenum; |
|
96 |
}; |
|
97 |
||
98 |
template <> |
|
99 |
struct QMacGLCompatTypes<long> |
|
100 |
{ |
|
101 |
typedef int CompatGLint; |
|
102 |
typedef unsigned int CompatGLuint; |
|
103 |
typedef unsigned int CompatGLenum; |
|
104 |
}; |
|
105 |
||
106 |
typedef QMacGLCompatTypes<GLint>::CompatGLint QMacCompatGLint; |
|
107 |
typedef QMacGLCompatTypes<GLint>::CompatGLuint QMacCompatGLuint; |
|
108 |
typedef QMacGLCompatTypes<GLint>::CompatGLenum QMacCompatGLenum; |
|
109 |
||
110 |
#endif |
|
111 |
||
112 |
#ifdef QT3_SUPPORT |
|
113 |
#define QGL_VERSION 460 |
|
114 |
#define QGL_VERSION_STR "4.6" |
|
115 |
inline QT3_SUPPORT const char *qGLVersion() { |
|
116 |
return QGL_VERSION_STR; |
|
117 |
} |
|
118 |
#endif |
|
119 |
||
120 |
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) |
|
121 |
class QGLCmap; |
|
122 |
#endif |
|
123 |
||
124 |
class QPixmap; |
|
125 |
#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) |
|
126 |
class QGLOverlayWidget; |
|
127 |
#endif |
|
128 |
class QGLWidgetPrivate; |
|
129 |
class QGLContextPrivate; |
|
130 |
||
131 |
// Namespace class: |
|
132 |
namespace QGL |
|
133 |
{ |
|
134 |
Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType); |
|
135 |
||
136 |
enum FormatOption { |
|
137 |
DoubleBuffer = 0x0001, |
|
138 |
DepthBuffer = 0x0002, |
|
139 |
Rgba = 0x0004, |
|
140 |
AlphaChannel = 0x0008, |
|
141 |
AccumBuffer = 0x0010, |
|
142 |
StencilBuffer = 0x0020, |
|
143 |
StereoBuffers = 0x0040, |
|
144 |
DirectRendering = 0x0080, |
|
145 |
HasOverlay = 0x0100, |
|
146 |
SampleBuffers = 0x0200, |
|
147 |
SingleBuffer = DoubleBuffer << 16, |
|
148 |
NoDepthBuffer = DepthBuffer << 16, |
|
149 |
ColorIndex = Rgba << 16, |
|
150 |
NoAlphaChannel = AlphaChannel << 16, |
|
151 |
NoAccumBuffer = AccumBuffer << 16, |
|
152 |
NoStencilBuffer = StencilBuffer << 16, |
|
153 |
NoStereoBuffers = StereoBuffers << 16, |
|
154 |
IndirectRendering = DirectRendering << 16, |
|
155 |
NoOverlay = HasOverlay << 16, |
|
156 |
NoSampleBuffers = SampleBuffers << 16 |
|
157 |
}; |
|
158 |
Q_DECLARE_FLAGS(FormatOptions, FormatOption) |
|
159 |
} |
|
160 |
||
161 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions) |
|
162 |
||
163 |
class QGLFormatPrivate; |
|
164 |
||
165 |
class Q_OPENGL_EXPORT QGLFormat |
|
166 |
{ |
|
167 |
public: |
|
168 |
QGLFormat(); |
|
169 |
QGLFormat(QGL::FormatOptions options, int plane = 0); |
|
170 |
QGLFormat(const QGLFormat &other); |
|
171 |
QGLFormat &operator=(const QGLFormat &other); |
|
172 |
~QGLFormat(); |
|
173 |
||
174 |
void setDepthBufferSize(int size); |
|
175 |
int depthBufferSize() const; |
|
176 |
||
177 |
void setAccumBufferSize(int size); |
|
178 |
int accumBufferSize() const; |
|
179 |
||
180 |
void setRedBufferSize(int size); |
|
181 |
int redBufferSize() const; |
|
182 |
||
183 |
void setGreenBufferSize(int size); |
|
184 |
int greenBufferSize() const; |
|
185 |
||
186 |
void setBlueBufferSize(int size); |
|
187 |
int blueBufferSize() const; |
|
188 |
||
189 |
void setAlphaBufferSize(int size); |
|
190 |
int alphaBufferSize() const; |
|
191 |
||
192 |
void setStencilBufferSize(int size); |
|
193 |
int stencilBufferSize() const; |
|
194 |
||
195 |
void setSampleBuffers(bool enable); |
|
196 |
bool sampleBuffers() const; |
|
197 |
||
198 |
void setSamples(int numSamples); |
|
199 |
int samples() const; |
|
200 |
||
201 |
void setSwapInterval(int interval); |
|
202 |
int swapInterval() const; |
|
203 |
||
204 |
bool doubleBuffer() const; |
|
205 |
void setDoubleBuffer(bool enable); |
|
206 |
bool depth() const; |
|
207 |
void setDepth(bool enable); |
|
208 |
bool rgba() const; |
|
209 |
void setRgba(bool enable); |
|
210 |
bool alpha() const; |
|
211 |
void setAlpha(bool enable); |
|
212 |
bool accum() const; |
|
213 |
void setAccum(bool enable); |
|
214 |
bool stencil() const; |
|
215 |
void setStencil(bool enable); |
|
216 |
bool stereo() const; |
|
217 |
void setStereo(bool enable); |
|
218 |
bool directRendering() const; |
|
219 |
void setDirectRendering(bool enable); |
|
220 |
bool hasOverlay() const; |
|
221 |
void setOverlay(bool enable); |
|
222 |
||
223 |
int plane() const; |
|
224 |
void setPlane(int plane); |
|
225 |
||
226 |
void setOption(QGL::FormatOptions opt); |
|
227 |
bool testOption(QGL::FormatOptions opt) const; |
|
228 |
||
229 |
static QGLFormat defaultFormat(); |
|
230 |
static void setDefaultFormat(const QGLFormat& f); |
|
231 |
||
232 |
static QGLFormat defaultOverlayFormat(); |
|
233 |
static void setDefaultOverlayFormat(const QGLFormat& f); |
|
234 |
||
235 |
static bool hasOpenGL(); |
|
236 |
static bool hasOpenGLOverlays(); |
|
237 |
||
238 |
enum OpenGLVersionFlag { |
|
239 |
OpenGL_Version_None = 0x00000000, |
|
240 |
OpenGL_Version_1_1 = 0x00000001, |
|
241 |
OpenGL_Version_1_2 = 0x00000002, |
|
242 |
OpenGL_Version_1_3 = 0x00000004, |
|
243 |
OpenGL_Version_1_4 = 0x00000008, |
|
244 |
OpenGL_Version_1_5 = 0x00000010, |
|
245 |
OpenGL_Version_2_0 = 0x00000020, |
|
246 |
OpenGL_Version_2_1 = 0x00000040, |
|
247 |
OpenGL_ES_Common_Version_1_0 = 0x00000080, |
|
248 |
OpenGL_ES_CommonLite_Version_1_0 = 0x00000100, |
|
249 |
OpenGL_ES_Common_Version_1_1 = 0x00000200, |
|
250 |
OpenGL_ES_CommonLite_Version_1_1 = 0x00000400, |
|
251 |
OpenGL_ES_Version_2_0 = 0x00000800, |
|
252 |
OpenGL_Version_3_0 = 0x00001000 |
|
253 |
}; |
|
254 |
Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag) |
|
255 |
||
256 |
static OpenGLVersionFlags openGLVersionFlags(); |
|
257 |
||
258 |
private: |
|
259 |
QGLFormatPrivate *d; |
|
260 |
||
261 |
void detach(); |
|
262 |
||
263 |
friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); |
|
264 |
friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); |
|
265 |
}; |
|
266 |
||
267 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags) |
|
268 |
||
269 |
Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&); |
|
270 |
Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&); |
|
271 |
||
272 |
class Q_OPENGL_EXPORT QGLContext |
|
273 |
{ |
|
274 |
Q_DECLARE_PRIVATE(QGLContext) |
|
275 |
public: |
|
276 |
QGLContext(const QGLFormat& format, QPaintDevice* device); |
|
277 |
QGLContext(const QGLFormat& format); |
|
278 |
virtual ~QGLContext(); |
|
279 |
||
280 |
virtual bool create(const QGLContext* shareContext = 0); |
|
281 |
bool isValid() const; |
|
282 |
bool isSharing() const; |
|
283 |
void reset(); |
|
284 |
||
285 |
static bool areSharing(const QGLContext *context1, const QGLContext *context2); |
|
286 |
||
287 |
QGLFormat format() const; |
|
288 |
QGLFormat requestedFormat() const; |
|
289 |
void setFormat(const QGLFormat& format); |
|
290 |
||
291 |
// ### Qt 5: return bools + maybe remove virtuals |
|
292 |
virtual void makeCurrent(); |
|
293 |
virtual void doneCurrent(); |
|
294 |
||
295 |
virtual void swapBuffers() const; |
|
296 |
||
297 |
enum BindOption { |
|
298 |
NoBindOption = 0x0000, |
|
299 |
InvertedYBindOption = 0x0001, |
|
300 |
MipmapBindOption = 0x0002, |
|
301 |
PremultipliedAlphaBindOption = 0x0004, |
|
302 |
LinearFilteringBindOption = 0x0008, |
|
303 |
||
304 |
MemoryManagedBindOption = 0x0010, // internal flag |
|
305 |
CanFlipNativePixmapBindOption = 0x0020, // internal flag |
|
306 |
||
307 |
DefaultBindOption = LinearFilteringBindOption |
|
308 |
| InvertedYBindOption |
|
309 |
| MipmapBindOption, |
|
310 |
InternalBindOption = MemoryManagedBindOption |
|
311 |
| PremultipliedAlphaBindOption |
|
312 |
}; |
|
313 |
Q_DECLARE_FLAGS(BindOptions, BindOption) |
|
314 |
||
315 |
GLuint bindTexture(const QImage &image, GLenum target, GLint format, |
|
316 |
BindOptions options); |
|
317 |
GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, |
|
318 |
BindOptions options); |
|
319 |
||
320 |
GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, |
|
321 |
GLint format = GL_RGBA); |
|
322 |
GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, |
|
323 |
GLint format = GL_RGBA); |
|
324 |
GLuint bindTexture(const QString &fileName); |
|
325 |
||
326 |
void deleteTexture(GLuint tx_id); |
|
327 |
||
328 |
void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); |
|
329 |
void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); |
|
330 |
||
331 |
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS |
|
332 |
GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, |
|
333 |
QMacCompatGLint format = GL_RGBA); |
|
334 |
GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, |
|
335 |
QMacCompatGLint format = GL_RGBA); |
|
336 |
GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, |
|
337 |
BindOptions); |
|
338 |
GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, |
|
339 |
BindOptions); |
|
340 |
||
341 |
void deleteTexture(QMacCompatGLuint tx_id); |
|
342 |
||
343 |
void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); |
|
344 |
void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); |
|
345 |
#endif |
|
346 |
||
347 |
static void setTextureCacheLimit(int size); |
|
348 |
static int textureCacheLimit(); |
|
349 |
||
350 |
void *getProcAddress(const QString &proc) const; |
|
351 |
QPaintDevice* device() const; |
|
352 |
QColor overlayTransparentColor() const; |
|
353 |
||
354 |
static const QGLContext* currentContext(); |
|
355 |
||
356 |
protected: |
|
357 |
virtual bool chooseContext(const QGLContext* shareContext = 0); |
|
358 |
||
359 |
#if defined(Q_WS_WIN) |
|
360 |
virtual int choosePixelFormat(void* pfd, HDC pdc); |
|
361 |
#endif |
|
362 |
#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) |
|
363 |
virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1); |
|
364 |
virtual void* chooseVisual(); |
|
365 |
#endif |
|
366 |
#if defined(Q_WS_MAC) |
|
367 |
virtual void* chooseMacVisual(GDHandle); |
|
368 |
#endif |
|
369 |
||
370 |
bool deviceIsPixmap() const; |
|
371 |
bool windowCreated() const; |
|
372 |
void setWindowCreated(bool on); |
|
373 |
bool initialized() const; |
|
374 |
void setInitialized(bool on); |
|
375 |
void generateFontDisplayLists(const QFont & fnt, int listBase); // ### Qt 5: remove |
|
376 |
||
377 |
uint colorIndex(const QColor& c) const; |
|
378 |
void setValid(bool valid); |
|
379 |
void setDevice(QPaintDevice *pDev); |
|
380 |
||
381 |
protected: |
|
382 |
static QGLContext* currentCtx; |
|
383 |
||
384 |
private: |
|
385 |
QScopedPointer<QGLContextPrivate> d_ptr; |
|
386 |
||
387 |
friend class QGLPixelBuffer; |
|
388 |
friend class QGLPixelBufferPrivate; |
|
389 |
friend class QGLWidget; |
|
390 |
friend class QGLWidgetPrivate; |
|
391 |
friend class QGLGlyphCache; |
|
392 |
friend class QOpenGLPaintEngine; |
|
393 |
friend class QOpenGLPaintEnginePrivate; |
|
394 |
friend class QGL2PaintEngineEx; |
|
395 |
friend class QGL2PaintEngineExPrivate; |
|
396 |
friend class QGLWindowSurface; |
|
397 |
friend class QGLPixmapData; |
|
398 |
friend class QGLPixmapFilterBase; |
|
399 |
friend class QGLTextureGlyphCache; |
|
400 |
friend class QGLShareRegister; |
|
401 |
friend class QGLSharedResourceGuard; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
402 |
friend class QGLPixmapBlurFilter; |
0 | 403 |
friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); |
404 |
#ifdef Q_WS_MAC |
|
405 |
public: |
|
406 |
void updatePaintDevice(); |
|
407 |
private: |
|
408 |
friend class QMacGLWindowChangeEvent; |
|
409 |
friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *); |
|
410 |
#endif |
|
411 |
friend class QGLFramebufferObject; |
|
412 |
friend class QGLFramebufferObjectPrivate; |
|
413 |
friend class QGLFBOGLPaintDevice; |
|
414 |
friend class QGLPaintDevice; |
|
415 |
friend class QX11GLPixmapData; |
|
416 |
private: |
|
417 |
Q_DISABLE_COPY(QGLContext) |
|
418 |
}; |
|
419 |
||
420 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions) |
|
421 |
||
422 |
class Q_OPENGL_EXPORT QGLWidget : public QWidget |
|
423 |
{ |
|
424 |
Q_OBJECT |
|
425 |
Q_DECLARE_PRIVATE(QGLWidget) |
|
426 |
public: |
|
427 |
explicit QGLWidget(QWidget* parent=0, |
|
428 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
429 |
explicit QGLWidget(QGLContext *context, QWidget* parent=0, |
|
430 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
431 |
explicit QGLWidget(const QGLFormat& format, QWidget* parent=0, |
|
432 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
433 |
#ifdef QT3_SUPPORT |
|
434 |
QT3_SUPPORT_CONSTRUCTOR QGLWidget(QWidget* parent, const char* name, |
|
435 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
436 |
QT3_SUPPORT_CONSTRUCTOR QGLWidget(QGLContext *context, QWidget* parent, const char* name, |
|
437 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
438 |
QT3_SUPPORT_CONSTRUCTOR QGLWidget(const QGLFormat& format, QWidget* parent, const char* name, |
|
439 |
const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0); |
|
440 |
#endif |
|
441 |
~QGLWidget(); |
|
442 |
||
443 |
void qglColor(const QColor& c) const; |
|
444 |
void qglClearColor(const QColor& c) const; |
|
445 |
||
446 |
bool isValid() const; |
|
447 |
bool isSharing() const; |
|
448 |
||
449 |
// ### Qt 5: return bools |
|
450 |
void makeCurrent(); |
|
451 |
void doneCurrent(); |
|
452 |
||
453 |
bool doubleBuffer() const; |
|
454 |
void swapBuffers(); |
|
455 |
||
456 |
QGLFormat format() const; |
|
457 |
void setFormat(const QGLFormat& format); |
|
458 |
||
459 |
const QGLContext* context() const; |
|
460 |
void setContext(QGLContext* context, const QGLContext* shareContext = 0, |
|
461 |
bool deleteOldContext = true); |
|
462 |
||
463 |
QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false); |
|
464 |
QImage grabFrameBuffer(bool withAlpha = false); |
|
465 |
||
466 |
void makeOverlayCurrent(); |
|
467 |
const QGLContext* overlayContext() const; |
|
468 |
||
469 |
static QImage convertToGLFormat(const QImage& img); |
|
470 |
||
471 |
void setMouseTracking(bool enable); |
|
472 |
||
473 |
const QGLColormap & colormap() const; |
|
474 |
void setColormap(const QGLColormap & map); |
|
475 |
||
476 |
void renderText(int x, int y, const QString & str, |
|
477 |
const QFont & fnt = QFont(), int listBase = 2000); |
|
478 |
void renderText(double x, double y, double z, const QString & str, |
|
479 |
const QFont & fnt = QFont(), int listBase = 2000); |
|
480 |
QPaintEngine *paintEngine() const; |
|
481 |
||
482 |
GLuint bindTexture(const QImage &image, GLenum target, GLint format, |
|
483 |
QGLContext::BindOptions options); |
|
484 |
GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, |
|
485 |
QGLContext::BindOptions options); |
|
486 |
||
487 |
GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, |
|
488 |
GLint format = GL_RGBA); |
|
489 |
GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, |
|
490 |
GLint format = GL_RGBA); |
|
491 |
||
492 |
GLuint bindTexture(const QString &fileName); |
|
493 |
||
494 |
void deleteTexture(GLuint tx_id); |
|
495 |
||
496 |
void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); |
|
497 |
void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); |
|
498 |
||
499 |
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS |
|
500 |
GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, |
|
501 |
QMacCompatGLint format = GL_RGBA); |
|
502 |
GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, |
|
503 |
QMacCompatGLint format = GL_RGBA); |
|
504 |
GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, |
|
505 |
QGLContext::BindOptions); |
|
506 |
GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, |
|
507 |
QGLContext::BindOptions); |
|
508 |
||
509 |
void deleteTexture(QMacCompatGLuint tx_id); |
|
510 |
||
511 |
void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); |
|
512 |
void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); |
|
513 |
#endif |
|
514 |
||
515 |
public Q_SLOTS: |
|
516 |
virtual void updateGL(); |
|
517 |
virtual void updateOverlayGL(); |
|
518 |
||
519 |
protected: |
|
520 |
bool event(QEvent *); |
|
521 |
virtual void initializeGL(); |
|
522 |
virtual void resizeGL(int w, int h); |
|
523 |
virtual void paintGL(); |
|
524 |
||
525 |
virtual void initializeOverlayGL(); |
|
526 |
virtual void resizeOverlayGL(int w, int h); |
|
527 |
virtual void paintOverlayGL(); |
|
528 |
||
529 |
void setAutoBufferSwap(bool on); |
|
530 |
bool autoBufferSwap() const; |
|
531 |
||
532 |
void paintEvent(QPaintEvent*); |
|
533 |
void resizeEvent(QResizeEvent*); |
|
534 |
||
535 |
virtual void glInit(); |
|
536 |
virtual void glDraw(); |
|
537 |
int fontDisplayListBase(const QFont & fnt, int listBase = 2000); // ### Qt 5: remove |
|
538 |
||
539 |
private: |
|
540 |
Q_DISABLE_COPY(QGLWidget) |
|
541 |
||
542 |
#ifdef Q_WS_MAC |
|
543 |
friend class QMacGLWindowChangeEvent; |
|
544 |
#endif |
|
545 |
friend class QGLDrawable; |
|
546 |
friend class QGLPixelBuffer; |
|
547 |
friend class QGLPixelBufferPrivate; |
|
548 |
friend class QGLContext; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
549 |
friend class QGLContextPrivate; |
0 | 550 |
friend class QGLOverlayWidget; |
551 |
friend class QOpenGLPaintEngine; |
|
552 |
friend class QGLPaintDevice; |
|
553 |
friend class QGLWidgetGLPaintDevice; |
|
554 |
}; |
|
555 |
||
556 |
||
557 |
// |
|
558 |
// QGLFormat inline functions |
|
559 |
// |
|
560 |
||
561 |
inline bool QGLFormat::doubleBuffer() const |
|
562 |
{ |
|
563 |
return testOption(QGL::DoubleBuffer); |
|
564 |
} |
|
565 |
||
566 |
inline bool QGLFormat::depth() const |
|
567 |
{ |
|
568 |
return testOption(QGL::DepthBuffer); |
|
569 |
} |
|
570 |
||
571 |
inline bool QGLFormat::rgba() const |
|
572 |
{ |
|
573 |
return testOption(QGL::Rgba); |
|
574 |
} |
|
575 |
||
576 |
inline bool QGLFormat::alpha() const |
|
577 |
{ |
|
578 |
return testOption(QGL::AlphaChannel); |
|
579 |
} |
|
580 |
||
581 |
inline bool QGLFormat::accum() const |
|
582 |
{ |
|
583 |
return testOption(QGL::AccumBuffer); |
|
584 |
} |
|
585 |
||
586 |
inline bool QGLFormat::stencil() const |
|
587 |
{ |
|
588 |
return testOption(QGL::StencilBuffer); |
|
589 |
} |
|
590 |
||
591 |
inline bool QGLFormat::stereo() const |
|
592 |
{ |
|
593 |
return testOption(QGL::StereoBuffers); |
|
594 |
} |
|
595 |
||
596 |
inline bool QGLFormat::directRendering() const |
|
597 |
{ |
|
598 |
return testOption(QGL::DirectRendering); |
|
599 |
} |
|
600 |
||
601 |
inline bool QGLFormat::hasOverlay() const |
|
602 |
{ |
|
603 |
return testOption(QGL::HasOverlay); |
|
604 |
} |
|
605 |
||
606 |
inline bool QGLFormat::sampleBuffers() const |
|
607 |
{ |
|
608 |
return testOption(QGL::SampleBuffers); |
|
609 |
} |
|
610 |
||
611 |
QT_END_NAMESPACE |
|
612 |
||
613 |
QT_END_HEADER |
|
614 |
||
615 |
#endif // QGL_H |