qglscreen_qws.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtOpenGL module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QSCREENEGL_P_H
00043 #define QSCREENEGL_P_H
00044 
00045 //
00046 //  W A R N I N G
00047 //  -------------
00048 //
00049 // This file is not part of the Qt API.  It exists for the convenience
00050 // of the QScreenEGL class.  This header file may change from
00051 // version to version without notice, or even be removed.
00052 //
00053 // We mean it.
00054 //
00055 
00056 #include <QtGui/QScreen>
00057 #include <QtOpenGL/qgl.h>
00058 #if defined(QT_OPENGL_ES_2)
00059 #include <EGL/egl.h>
00060 #else
00061 #include <GLES/egl.h>
00062 #endif
00063 #if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
00064 #undef EGLNativeWindowType
00065 #undef EGLNativePixmapType
00066 #undef EGLNativeDisplayType
00067 typedef NativeWindowType EGLNativeWindowType;
00068 typedef NativePixmapType EGLNativePixmapType;
00069 typedef NativeDisplayType EGLNativeDisplayType;
00070 #define QEGL_NATIVE_TYPES_DEFINED 1
00071 #endif
00072 
00073 QT_BEGIN_HEADER
00074 
00075 QT_BEGIN_NAMESPACE
00076 
00077 QT_MODULE(OpenGL)
00078 
00079 class QGLScreenPrivate;
00080 
00081 class Q_OPENGL_EXPORT QGLScreenSurfaceFunctions
00082 {
00083 public:
00084     virtual bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native);
00085     virtual bool createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native);
00086     virtual bool createNativeImage(QImage *image, EGLNativePixmapType *native);
00087 };
00088 
00089 class Q_OPENGL_EXPORT QGLScreen : public QScreen
00090 {
00091     Q_DECLARE_PRIVATE(QGLScreen)
00092 public:
00093     QGLScreen(int displayId);
00094     virtual ~QGLScreen();
00095 
00096     enum Option
00097     {
00098         NoOptions       = 0,
00099         NativeWindows   = 1,
00100         NativePixmaps   = 2,
00101         NativeImages    = 4,
00102         Overlays        = 8
00103     };
00104     Q_DECLARE_FLAGS(Options, Option)
00105 
00106     QGLScreen::Options options() const;
00107 
00108     virtual bool chooseContext(QGLContext *context, const QGLContext *shareContext);
00109     virtual bool hasOpenGL() = 0;
00110 
00111     QGLScreenSurfaceFunctions *surfaceFunctions() const;
00112 
00113 protected:
00114     void setOptions(QGLScreen::Options value);
00115     void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions);
00116 
00117 private:
00118     QGLScreenPrivate *d_ptr;
00119 };
00120 
00121 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLScreen::Options)
00122 
00123 QT_END_NAMESPACE
00124 
00125 QT_END_HEADER
00126 
00127 #endif // QSCREENEGL_P_H