Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the QtOpenGL module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include <QGLScreen>
43#include <QGLContext>
44#include <QGLWidget>
45#include "private/qglwindowsurface_qws_p.h"
46
47QT_BEGIN_NAMESPACE
48
49class QGLScreenPrivate
50{
51public:
52 QGLScreen::Options options;
53 QGLScreenSurfaceFunctions *functions;
54};
55
56/*!
57 \internal
58 \preliminary
59 \class QGLScreen
60
61 \brief This class encapsulates an OpenGL screen driver.
62*/
63
64QGLScreen::QGLScreen(int displayId)
65 : QScreen(displayId, GLClass), d_ptr(new QGLScreenPrivate)
66{
67 d_ptr->options = NoOptions;
68 d_ptr->functions = new QGLScreenSurfaceFunctions();
69}
70
71QGLScreen::~QGLScreen()
72{
73 delete d_ptr->functions;
74 delete d_ptr;
75}
76
77/*!
78 \since 4.3
79 \obsolete
80
81 Initializes the \a context and sets up the QGLWindowSurface of the
82 QWidget of \a context based on the parameters of \a context and
83 based on its own requirements. The format() of \a context needs
84 to be updated with the actual parameters of the OpenGLES drawable
85 that was set up.
86
87 \a shareContext is used in the same way as for QGLContext. It is
88 the context with which \a context shares display lists and texture
89 ids etc. The window surface must be set up so that this sharing
90 works.
91
92 Returns true in case of success and false if it is not possible to
93 create the necessary OpenGLES drawable/context.
94
95 Since 4.4.2, this function will be not be called if options()
96 indicates that a native window or pixmap drawable can be created
97 via the functions in the surfaceFunctions() object.
98
99 This function is obsolete in Qt 4.5 and higher. Use surfaceFunctions()
100 instead.
101
102 \sa options(), surfaceFunctions()
103*/
104bool
105QGLScreen::chooseContext(QGLContext *context, const QGLContext *shareContext)
106{
107 Q_UNUSED(context);
108 Q_UNUSED(shareContext);
109 return false;
110}
111
112/*!
113 \enum QGLScreen::Option
114 This enum defines options that can be set on QGLScreen instances.
115
116 \value NoOptions There are no special options on the screen. This is the default.
117 \value NativeWindows Native windows can be created with QGLScreenSurfaceFunctions::createNativeWindow().
118 \value NativePixmaps Native pixmaps can be created with QGLScreenSurfaceFunctions::createNativePixmap().
119 \value NativeImages Native images can be created with QGLScreenSurfaceFunctions::createNativeImage().
120 \value Overlays The screen supports GL overlays.
121*/
122
123/*!
124 \since 4.4.2
125
126 Returns the options associated with this QGLScreen.
127
128 \sa setOptions()
129*/
130QGLScreen::Options QGLScreen::options() const
131{
132 return d_ptr->options;
133}
134
135/*!
136 \since 4.4.2
137
138 Sets the options associated with this QGLScreen to \a value.
139
140 \sa options()
141*/
142void QGLScreen::setOptions(QGLScreen::Options value)
143{
144 d_ptr->options = value;
145}
146
147/*!
148 \since 4.4.2
149
150 Returns the surface functions object for this QGLScreen.
151
152 \sa setSurfaceFunctions()
153*/
154QGLScreenSurfaceFunctions *QGLScreen::surfaceFunctions() const
155{
156 return d_ptr->functions;
157}
158
159/*!
160 \since 4.4.2
161
162 Sets the surface functions object for this QGLScreen to \a functions.
163 The QGLScreen will take over ownership of \a functions and delete
164 it when the QGLScreen is deleted.
165
166 \sa setSurfaceFunctions()
167*/
168void QGLScreen::setSurfaceFunctions(QGLScreenSurfaceFunctions *functions)
169{
170 if (functions && functions != d_ptr->functions) {
171 delete d_ptr->functions;
172 d_ptr->functions = functions;
173 }
174}
175
176/*!
177 \internal
178 \preliminary
179 \class QGLScreenSurfaceFunctions
180 \brief The QGLScreenSurfaceFunctions class encapsulates the functions for creating native windows and pixmaps for OpenGL ES.
181*/
182
183/*!
184 \since 4.4.2
185
186 Creates a native OpenGLES drawable for the surface of \a widget and
187 returns it in \a native. Returns true if the OpenGLES drawable could
188 be created, or false if windows are not supported.
189
190 This function will be called if the NativeWindows option is set on
191 the screen.
192
193 \sa createNativePixmap(), createNativeImage(), QGLScreen::options()
194*/
195bool QGLScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native)
196{
197 Q_UNUSED(widget);
198 Q_UNUSED(native);
199 return false;
200}
201
202/*!
203 \since 4.4.2
204
205 Creates a native OpenGLES drawable for directly rendering into
206 \a pixmap and returns it in \a native. Returns true if the OpenGLES
207 drawable could be created, or false if direct rendering into pixmaps
208 is not supported.
209
210 This function will be called if the NativePixmaps option is set on
211 the screen.
212
213 \sa createNativeWindow(), createNativeImage(), QGLScreen::options()
214*/
215bool QGLScreenSurfaceFunctions::createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native)
216{
217 Q_UNUSED(pixmap);
218 Q_UNUSED(native);
219 return false;
220}
221
222/*!
223 \since 4.4.2
224
225 Creates a native OpenGLES drawable for directly rendering into
226 \a image and returns it in \a native. Returns true if the OpenGLES
227 drawable could be created, or false if direct rendering into images
228 is not supported.
229
230 This function will be called if the NativeImages option is set on
231 the screen.
232
233 \sa createNativeWindow(), createNativePixmap(), QGLScreen::options()
234*/
235bool QGLScreenSurfaceFunctions::createNativeImage(QImage *image, EGLNativePixmapType *native)
236{
237 Q_UNUSED(image);
238 Q_UNUSED(native);
239 return false;
240}
241
242QT_END_NAMESPACE
243

Warning: That file was not part of the compilation database. It may have many parsing errors.