1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the opengl module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "private/qwidget_p.h"
33
#include "qglcolormap.h"
38
class QGLOverlayWidget;
41
class QMacWindowChangeEvent;
44
class QGLFormatPrivate
48
opts = QGL::DoubleBuffer | QGL::DepthBuffer | QGL::Rgba | QGL::DirectRendering;
50
depthSize = accumSize = stencilSize = alphaSize = -1;
53
QGL::FormatOptions opts;
62
class QGLWidgetPrivate : public QWidgetPrivate
64
Q_DECLARE_PUBLIC(QGLWidget)
66
QGLWidgetPrivate() : QWidgetPrivate() {}
67
~QGLWidgetPrivate() {}
69
void init(QGLContext *context, const QGLWidget* shareWidget);
70
bool renderCxPm(QPixmap *pixmap);
71
void cleanupColormaps();
77
QMap<QString, int> displayListCache;
81
#elif defined(Q_WS_X11)
82
QGLOverlayWidget *olw;
83
#elif defined(Q_WS_MAC)
85
void updatePaintDevice();
86
QMacWindowChangeEvent *watcher;
90
class QGLContextPrivate
92
Q_DECLARE_PUBLIC(QGLContext)
94
explicit QGLContextPrivate(QGLContext *context) : q_ptr(context) {}
95
~QGLContextPrivate() {}
96
GLuint bindTexture(const QImage &image, GLenum target, GLint format, const QString &key);
97
void init(QPaintDevice *dev, const QGLFormat &format);
107
#elif defined(Q_WS_X11) || defined(Q_WS_MAC)
110
#if defined(Q_WS_X11)
121
QPaintDevice *paintDevice;
126
// GL extension definitions
127
class QGLExtensions {
130
TextureRectangle = 0x00000001,
131
SampleBuffers = 0x00000002,
132
GenerateMipmap = 0x00000004,
133
TextureCompression = 0x00000008
135
Q_DECLARE_FLAGS(Extensions, Extension)
137
static Extensions glExtensions;
138
static void init(); // sys dependent
139
static void init_extensions(); // general: called by init()
142
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions)
144
/* NV_texture_rectangle */
145
#ifndef GL_NV_texture_rectangle
146
#define GL_TEXTURE_RECTANGLE_NV 0x84F5
147
#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
148
#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
149
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8