Changeset 561 for trunk/src/opengl/qgl.h


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/qgl.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtOpenGL module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545#include <QtGui/qwidget.h>
     46#include <QtGui/qpaintengine.h>
    4647#include <QtOpenGL/qglcolormap.h>
    4748#include <QtCore/qmap.h>
     49#include <QtCore/qscopedpointer.h>
    4850
    4951QT_BEGIN_HEADER
     
    130132namespace QGL
    131133{
     134    Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType);
     135
    132136    enum FormatOption {
    133137        DoubleBuffer            = 0x0001,
     
    255259    QGLFormatPrivate *d;
    256260
     261    void detach();
     262
    257263    friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
    258264    friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
     
    277283    void reset();
    278284
    279     // ### Qt 5: make format() return a const ref instead
     285    static bool areSharing(const QGLContext *context1, const QGLContext *context2);
     286
    280287    QGLFormat format() const;
    281288    QGLFormat requestedFormat() const;
     
    287294
    288295    virtual void swapBuffers() const;
     296
     297    enum BindOption {
     298        NoBindOption                            = 0x0000,
     299        InvertedYBindOption                     = 0x0001,
     300        MipmapBindOption                        = 0x0002,
     301        PremultipliedAlphaBindOption            = 0x0004,
     302        LinearFilteringBindOption               = 0x0008,
     303
     304        MemoryManagedBindOption                 = 0x0010, // internal flag
     305        CanFlipNativePixmapBindOption           = 0x0020, // internal flag
     306
     307        DefaultBindOption                       = LinearFilteringBindOption
     308                                                  | InvertedYBindOption
     309                                                  | MipmapBindOption,
     310        InternalBindOption                      = MemoryManagedBindOption
     311                                                  | PremultipliedAlphaBindOption
     312    };
     313    Q_DECLARE_FLAGS(BindOptions, BindOption)
     314
     315    GLuint bindTexture(const QImage &image, GLenum target, GLint format,
     316                       BindOptions options);
     317    GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
     318                       BindOptions options);
    289319
    290320    GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
     
    304334    GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
    305335                       QMacCompatGLint format = GL_RGBA);
     336    GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
     337                       BindOptions);
     338    GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
     339                       BindOptions);
    306340
    307341    void deleteTexture(QMacCompatGLuint tx_id);
     
    349383
    350384private:
    351     QGLContextPrivate* d_ptr;
     385    QScopedPointer<QGLContextPrivate> d_ptr;
    352386
    353387    friend class QGLPixelBuffer;
    354388    friend class QGLPixelBufferPrivate;
    355389    friend class QGLWidget;
    356     friend class QGLDrawable;
    357390    friend class QGLWidgetPrivate;
    358391    friend class QGLGlyphCache;
     
    364397    friend class QGLPixmapData;
    365398    friend class QGLPixmapFilterBase;
     399    friend class QGLTextureGlyphCache;
     400    friend class QGLShareRegister;
     401    friend class QGLSharedResourceGuard;
     402    friend class QGLPixmapBlurFilter;
    366403    friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
    367404#ifdef Q_WS_MAC
     
    372409    friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *);
    373410#endif
    374 #ifdef Q_WS_WIN
    375411    friend class QGLFramebufferObject;
    376412    friend class QGLFramebufferObjectPrivate;
    377     friend bool qt_resolve_GLSL_functions(QGLContext *ctx);
    378     friend bool qt_createGLSLProgram(QGLContext *ctx, GLuint &program, const char *shader_src, GLuint &shader);
    379 #endif
     413    friend class QGLFBOGLPaintDevice;
     414    friend class QGLPaintDevice;
     415    friend class QX11GLPixmapData;
    380416private:
    381417    Q_DISABLE_COPY(QGLContext)
    382418};
    383419
     420Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)
    384421
    385422class Q_OPENGL_EXPORT QGLWidget : public QWidget
     
    417454    void swapBuffers();
    418455
    419     // ### Qt 5: make format() return a const ref instead
    420456    QGLFormat format() const;
    421457    void setFormat(const QGLFormat& format);
     
    444480    QPaintEngine *paintEngine() const;
    445481
     482    GLuint bindTexture(const QImage &image, GLenum target, GLint format,
     483                       QGLContext::BindOptions options);
     484    GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
     485                       QGLContext::BindOptions options);
     486
    446487    GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
    447488                       GLint format = GL_RGBA);
    448489    GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
    449490                       GLint format = GL_RGBA);
     491
    450492    GLuint bindTexture(const QString &fileName);
    451493
     
    460502    GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
    461503                       QMacCompatGLint format = GL_RGBA);
     504    GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
     505                       QGLContext::BindOptions);
     506    GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
     507                       QGLContext::BindOptions);
    462508
    463509    void deleteTexture(QMacCompatGLuint tx_id);
     
    501547    friend class QGLPixelBufferPrivate;
    502548    friend class QGLContext;
     549    friend class QGLContextPrivate;
    503550    friend class QGLOverlayWidget;
    504551    friend class QOpenGLPaintEngine;
     552    friend class QGLPaintDevice;
     553    friend class QGLWidgetGLPaintDevice;
    505554};
    506555
Note: See TracChangeset for help on using the changeset viewer.