source: trunk/src/opengl/qglscreen_qws.cpp@ 603

Last change on this file since 603 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

  • Property svn:eol-style set to native
File size: 7.1 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtOpenGL module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
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** 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 have questions regarding the use of this file, please contact
37** Nokia at [email protected].
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