00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved. 00004 ** 00005 ** This file is part of the QtOpenGL module of the Qt Toolkit. 00006 ** 00007 ** This file may be used under the terms of the GNU General Public 00008 ** License version 2.0 as published by the Free Software Foundation 00009 ** and appearing in the file LICENSE.GPL included in the packaging of 00010 ** this file. Please review the following information to ensure GNU 00011 ** General Public Licensing requirements will be met: 00012 ** http://www.trolltech.com/products/qt/opensource.html 00013 ** 00014 ** If you are unsure which license is appropriate for your use, please 00015 ** review the following information: 00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the 00017 ** sales department at sales@trolltech.com. 00018 ** 00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 ** 00022 ****************************************************************************/ 00023 00024 #ifndef QGLPIXELBUFFER_H 00025 #define QGLPIXELBUFFER_H 00026 00027 #include <QtOpenGL/qgl.h> 00028 #include <QtGui/qpaintdevice.h> 00029 00030 QT_BEGIN_HEADER 00031 00032 QT_MODULE(OpenGL) 00033 00034 class QGLPixelBufferPrivate; 00035 00036 class Q_OPENGL_EXPORT QGLPixelBuffer : public QPaintDevice 00037 { 00038 Q_DECLARE_PRIVATE(QGLPixelBuffer) 00039 public: 00040 QGLPixelBuffer(const QSize &size, const QGLFormat &format = QGLFormat::defaultFormat(), 00041 QGLWidget *shareWidget = 0); 00042 QGLPixelBuffer(int width, int height, const QGLFormat &format = QGLFormat::defaultFormat(), 00043 QGLWidget *shareWidget = 0); 00044 virtual ~QGLPixelBuffer(); 00045 00046 bool isValid() const; 00047 bool makeCurrent(); 00048 bool doneCurrent(); 00049 00050 GLuint generateDynamicTexture() const; 00051 bool bindToDynamicTexture(GLuint texture); 00052 void releaseFromDynamicTexture(); 00053 void updateDynamicTexture(GLuint texture_id) const; 00054 00055 GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D); 00056 GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D); 00057 GLuint bindTexture(const QString &fileName); 00058 void deleteTexture(GLuint texture_id); 00059 00060 QSize size() const; 00061 Qt::HANDLE handle() const; 00062 QImage toImage() const; 00063 00064 QPaintEngine *paintEngine() const; 00065 QGLFormat format() const; 00066 00067 static bool hasOpenGLPbuffers(); 00068 00069 protected: 00070 int metric(PaintDeviceMetric metric) const; 00071 int devType() const { return QInternal::Pbuffer; } 00072 00073 private: 00074 Q_DISABLE_COPY(QGLPixelBuffer) 00075 QGLPixelBufferPrivate *d_ptr; 00076 friend class QGLDrawable; 00077 }; 00078 00079 QT_END_HEADER 00080 00081 #endif // QGLPIXELBUFFER_H
1.5.1