source: trunk/src/opengl/qglpixelbuffer_p.h@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtOpenGL module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QGLPIXELBUFFER_P_H
43#define QGLPIXELBUFFER_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
50// of the QLibrary class. This header file may change from
51// version to version without notice, or even be removed.
52//
53// We mean it.
54//
55
56QT_BEGIN_NAMESPACE
57
58QT_BEGIN_INCLUDE_NAMESPACE
59#include "QtOpenGL/qglpixelbuffer.h"
60#include <private/qgl_p.h>
61
62#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
63#include <GL/glx.h>
64
65// The below is needed to for compilation on HPUX, due to broken GLX
66// headers. Some of the systems define GLX_VERSION_1_3 without
67// defining the GLXFBConfig structure, which is wrong.
68#if defined (Q_OS_HPUX) && defined(QT_DEFINE_GLXFBCONFIG_STRUCT)
69typedef unsigned long GLXPbuffer;
70
71struct GLXFBConfig {
72 int visualType;
73 int transparentType;
74 /* colors are floats scaled to ints */
75 int transparentRed, transparentGreen, transparentBlue, transparentAlpha;
76 int transparentIndex;
77
78 int visualCaveat;
79
80 int associatedVisualId;
81 int screen;
82
83 int drawableType;
84 int renderType;
85
86 int maxPbufferWidth, maxPbufferHeight, maxPbufferPixels;
87 int optimalPbufferWidth, optimalPbufferHeight; /* for SGIX_pbuffer */
88
89 int visualSelectGroup; /* visuals grouped by select priority */
90
91 unsigned int id;
92
93 GLboolean rgbMode;
94 GLboolean colorIndexMode;
95 GLboolean doubleBufferMode;
96 GLboolean stereoMode;
97 GLboolean haveAccumBuffer;
98 GLboolean haveDepthBuffer;
99 GLboolean haveStencilBuffer;
100
101 /* The number of bits present in various buffers */
102 GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
103 GLint depthBits;
104 GLint stencilBits;
105 GLint indexBits;
106 GLint redBits, greenBits, blueBits, alphaBits;
107 GLuint redMask, greenMask, blueMask, alphaMask;
108
109 GLuint multiSampleSize; /* Number of samples per pixel (0 if no ms) */
110
111 GLuint nMultiSampleBuffers; /* Number of available ms buffers */
112 GLint maxAuxBuffers;
113
114 /* frame buffer level */
115 GLint level;
116
117 /* color ranges (for SGI_color_range) */
118 GLboolean extendedRange;
119 GLdouble minRed, maxRed;
120 GLdouble minGreen, maxGreen;
121 GLdouble minBlue, maxBlue;
122 GLdouble minAlpha, maxAlpha;
123};
124
125#endif // Q_OS_HPUX
126
127#elif defined(Q_WS_WIN)
128DECLARE_HANDLE(HPBUFFERARB);
129#elif defined(QT_OPENGL_ES_2)
130#include <EGL/egl.h>
131#elif defined(QT_OPENGL_ES)
132#include <GLES/egl.h>
133#endif
134QT_END_INCLUDE_NAMESPACE
135
136class QEglContext;
137
138class QGLPixelBufferPrivate {
139 Q_DECLARE_PUBLIC(QGLPixelBuffer)
140public:
141 QGLPixelBufferPrivate(QGLPixelBuffer *q) : q_ptr(q), invalid(true), qctx(0), pbuf(0), ctx(0)
142 {
143 QGLExtensions::init();
144#ifdef Q_WS_WIN
145 dc = 0;
146#elif defined(Q_WS_MACX)
147 share_ctx = 0;
148#endif
149 }
150 bool init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget);
151 void common_init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget);
152 bool cleanup();
153
154 QGLPixelBuffer *q_ptr;
155 bool invalid;
156 QGLContext *qctx;
157 QGLFormat format;
158
159 QGLFormat req_format;
160 QPointer<QGLWidget> req_shareWidget;
161 QSize req_size;
162
163#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
164 GLXPbuffer pbuf;
165 GLXContext ctx;
166#elif defined(Q_WS_WIN)
167 HDC dc;
168 bool has_render_texture :1;
169#if !defined(QT_OPENGL_ES)
170 HPBUFFERARB pbuf;
171 HGLRC ctx;
172#endif
173#elif defined(Q_WS_MACX)
174# ifdef QT_MAC_USE_COCOA
175 void *pbuf;
176 void *ctx;
177 void *share_ctx;
178# else
179 AGLPbuffer pbuf;
180 AGLContext ctx;
181 AGLContext share_ctx;
182# endif
183#endif
184#if defined(QT_OPENGL_ES)
185 EGLSurface pbuf;
186 QEglContext *ctx;
187 int textureFormat;
188#endif
189};
190
191QT_END_NAMESPACE
192
193#endif // QGLPIXELBUFFER_P_H
Note: See TracBrowser for help on using the repository browser.