Qt 4.8
qglframebufferobject_p.h
Go to the documentation of this file.
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 #ifndef QGLFRAMEBUFFEROBJECT_P_H
43 #define QGLFRAMEBUFFEROBJECT_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists for the convenience
50 // of the QLibrary class. This header file may change from
51 // version to version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
57 
59 
60 #include <qglframebufferobject.h>
61 #include <private/qglpaintdevice_p.h>
62 #include <private/qgl_p.h>
63 
65 
66 #ifndef QT_OPENGL_ES
67 #define DEFAULT_FORMAT GL_RGBA8
68 #else
69 #define DEFAULT_FORMAT GL_RGBA
70 #endif
71 
73 {
74 public:
76  : ref(1),
77  samples(0),
78  attachment(QGLFramebufferObject::NoAttachment),
81  mipmap(false)
82  {
83  }
86  : ref(1),
87  samples(other->samples),
88  attachment(other->attachment),
89  target(other->target),
91  mipmap(other->mipmap)
92  {
93  }
95  {
96  return samples == other->samples &&
97  attachment == other->attachment &&
98  target == other->target &&
99  internal_format == other->internal_format &&
100  mipmap == other->mipmap;
101  }
102 
104  int samples;
109 };
110 
112 {
113 public:
114  virtual QPaintEngine* paintEngine() const {return fbo->paintEngine();}
115  virtual QSize size() const {return fbo->size();}
116  virtual QGLContext* context() const;
117  virtual QGLFormat format() const {return fboFormat;}
118  virtual bool alphaRequested() const { return reqAlpha; }
119 
120  void setFBO(QGLFramebufferObject* f,
122 
123 private:
126  bool wasBound;
127  bool reqAlpha;
128 };
129 
131 {
132 public:
133  QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0)
134  , color_buffer(0), valid(false), engine(0) {}
136 
137  void init(QGLFramebufferObject *q, const QSize& sz,
139  GLenum internal_format, GLenum texture_target,
140  GLint samples = 0, bool mipmap = false);
141  bool checkFramebufferStatus() const;
143  GLuint texture;
144  GLuint depth_buffer;
146  GLuint color_buffer;
150  uint valid : 1;
154 
155  inline GLuint fbo() const { return fbo_guard.id(); }
156 };
157 
158 
160 
161 #endif // QGLFRAMEBUFFEROBJECT_P_H
bool equals(const QGLFramebufferObjectFormatPrivate *other)
GLuint id() const
Definition: qgl_p.h:880
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QAtomicInt class provides platform-independent atomic operations on integers. ...
Definition: qatomic.h:55
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
QGLFramebufferObject::Attachment attachment
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
Definition: qglobal.h:92
#define GL_TEXTURE_2D
Attachment
This enum type is used to configure the depth and stencil buffers attached to the framebuffer object ...
virtual QGLFormat format() const
QGLSharedResourceGuard fbo_guard
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QGLFormat class specifies the display format of an OpenGL rendering context.
Definition: qgl.h:175
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
static bool init
unsigned int uint
Definition: qglobal.h:996
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
#define DEFAULT_FORMAT
QGLFramebufferObject * fbo
unsigned int GLenum
Definition: main.cpp:50
QGLFramebufferObjectFormat format
virtual QPaintEngine * paintEngine() const
QGLFramebufferObject::Attachment fbo_attachment
typedef GLint
Definition: glfunctions.h:67
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
Definition: qglobal.h:91
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
virtual QSize size() const
The QGLFramebufferObjectFormat class specifies the format of an OpenGL framebuffer object...
virtual bool alphaRequested() const