Qt 4.8
qt-4.8.6
src
opengl
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
56
QT_BEGIN_NAMESPACE
57
58
QT_BEGIN_INCLUDE_NAMESPACE
59
60
#include <
qglframebufferobject.h
>
61
#include <private/qglpaintdevice_p.h>
62
#include <private/qgl_p.h>
63
64
QT_END_INCLUDE_NAMESPACE
65
66
#ifndef QT_OPENGL_ES
67
#define DEFAULT_FORMAT GL_RGBA8
68
#else
69
#define DEFAULT_FORMAT GL_RGBA
70
#endif
71
72
class
QGLFramebufferObjectFormatPrivate
73
{
74
public
:
75
QGLFramebufferObjectFormatPrivate
()
76
:
ref
(1),
77
samples
(0),
78
attachment
(
QGLFramebufferObject
::NoAttachment),
79
target
(
GL_TEXTURE_2D
),
80
internal_format
(
DEFAULT_FORMAT
),
81
mipmap
(false)
82
{
83
}
84
QGLFramebufferObjectFormatPrivate
85
(
const
QGLFramebufferObjectFormatPrivate
*other)
86
:
ref
(1),
87
samples
(other->
samples
),
88
attachment
(other->
attachment
),
89
target
(other->
target
),
90
internal_format
(other->
internal_format
),
91
mipmap
(other->
mipmap
)
92
{
93
}
94
bool
equals
(
const
QGLFramebufferObjectFormatPrivate
*other)
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
103
QAtomicInt
ref
;
104
int
samples
;
105
QGLFramebufferObject::Attachment
attachment
;
106
GLenum
target
;
107
GLenum
internal_format
;
108
uint
mipmap
: 1;
109
};
110
111
class
QGLFBOGLPaintDevice
:
public
QGLPaintDevice
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,
121
QGLFramebufferObject::Attachment
attachment
);
122
123
private
:
124
QGLFramebufferObject
*
fbo
;
125
QGLFormat
fboFormat
;
126
bool
wasBound
;
127
bool
reqAlpha
;
128
};
129
130
class
QGLFramebufferObjectPrivate
131
{
132
public
:
133
QGLFramebufferObjectPrivate
() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0)
134
, color_buffer(0), valid(false), engine(0) {}
135
~QGLFramebufferObjectPrivate
() {}
136
137
void
init
(
QGLFramebufferObject
*q,
const
QSize
& sz,
138
QGLFramebufferObject::Attachment
attachment
,
139
GLenum
internal_format
,
GLenum
texture_target,
140
GLint
samples
= 0,
bool
mipmap
=
false
);
141
bool
checkFramebufferStatus()
const
;
142
QGLSharedResourceGuard
fbo_guard
;
143
GLuint
texture
;
144
GLuint
depth_buffer
;
145
GLuint
stencil_buffer
;
146
GLuint
color_buffer
;
147
GLenum
target
;
148
QSize
size
;
149
QGLFramebufferObjectFormat
format
;
150
uint
valid
: 1;
151
QGLFramebufferObject::Attachment
fbo_attachment
;
152
mutable
QPaintEngine
*
engine
;
153
QGLFBOGLPaintDevice
glDevice
;
154
155
inline
GLuint
fbo
()
const
{
return
fbo_guard.
id
(); }
156
};
157
158
159
QT_END_NAMESPACE
160
161
#endif // QGLFRAMEBUFFEROBJECT_P_H
QGLFramebufferObjectPrivate::~QGLFramebufferObjectPrivate
~QGLFramebufferObjectPrivate()
Definition:
qglframebufferobject_p.h:135
QGLFramebufferObjectFormatPrivate::equals
bool equals(const QGLFramebufferObjectFormatPrivate *other)
Definition:
qglframebufferobject_p.h:94
QGLSharedResourceGuard::id
GLuint id() const
Definition:
qgl_p.h:880
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QGLFBOGLPaintDevice::wasBound
bool wasBound
Definition:
qglframebufferobject_p.h:126
QAtomicInt
The QAtomicInt class provides platform-independent atomic operations on integers. ...
Definition:
qatomic.h:55
QGLFramebufferObject
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
Definition:
qglframebufferobject.h:57
QGLFramebufferObjectPrivate::glDevice
QGLFBOGLPaintDevice glDevice
Definition:
qglframebufferobject_p.h:153
QGLFramebufferObjectFormatPrivate::attachment
QGLFramebufferObject::Attachment attachment
Definition:
qglframebufferobject_p.h:105
QT_END_INCLUDE_NAMESPACE
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
Definition:
qglobal.h:92
QGLPaintDevice
Definition:
qglpaintdevice_p.h:63
QGLFramebufferObjectPrivate
Definition:
qglframebufferobject_p.h:130
QGLFramebufferObjectFormatPrivate::ref
QAtomicInt ref
Definition:
qglframebufferobject_p.h:103
GL_TEXTURE_2D
#define GL_TEXTURE_2D
Definition:
qglfunctions.h:2150
QGLFramebufferObject::Attachment
Attachment
This enum type is used to configure the depth and stencil buffers attached to the framebuffer object ...
Definition:
qglframebufferobject.h:61
QGLFBOGLPaintDevice::format
virtual QGLFormat format() const
Definition:
qglframebufferobject_p.h:117
QGLSharedResourceGuard
Definition:
qgl_p.h:858
QGLFramebufferObjectPrivate::fbo_guard
QGLSharedResourceGuard fbo_guard
Definition:
qglframebufferobject_p.h:142
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
QGLFramebufferObjectFormatPrivate::target
GLenum target
Definition:
qglframebufferobject_p.h:106
QGLFormat
The QGLFormat class specifies the display format of an OpenGL rendering context.
Definition:
qgl.h:175
QGLContext
The QGLContext class encapsulates an OpenGL rendering context.
Definition:
qgl.h:310
init
static bool init
Definition:
qclipboard_qws.cpp:67
qglframebufferobject.h
QGLFramebufferObjectPrivate::texture
GLuint texture
Definition:
qglframebufferobject_p.h:143
uint
unsigned int uint
Definition:
qglobal.h:996
QPaintEngine
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition:
qpaintengine.h:90
QGLFBOGLPaintDevice::fboFormat
QGLFormat fboFormat
Definition:
qglframebufferobject_p.h:125
DEFAULT_FORMAT
#define DEFAULT_FORMAT
Definition:
qglframebufferobject_p.h:67
QGLFBOGLPaintDevice::fbo
QGLFramebufferObject * fbo
Definition:
qglframebufferobject_p.h:124
QGLFramebufferObjectFormatPrivate::samples
int samples
Definition:
qglframebufferobject_p.h:104
GLenum
unsigned int GLenum
Definition:
main.cpp:50
QGLFramebufferObjectPrivate::format
QGLFramebufferObjectFormat format
Definition:
qglframebufferobject_p.h:149
QGLFramebufferObjectPrivate::target
GLenum target
Definition:
qglframebufferobject_p.h:147
QGLFramebufferObjectPrivate::depth_buffer
GLuint depth_buffer
Definition:
qglframebufferobject_p.h:144
QGLFBOGLPaintDevice::paintEngine
virtual QPaintEngine * paintEngine() const
Definition:
qglframebufferobject_p.h:114
QGLFramebufferObjectPrivate::fbo
GLuint fbo() const
Definition:
qglframebufferobject_p.h:155
QGLFramebufferObjectPrivate::fbo_attachment
QGLFramebufferObject::Attachment fbo_attachment
Definition:
qglframebufferobject_p.h:151
QGLFramebufferObjectPrivate::color_buffer
GLuint color_buffer
Definition:
qglframebufferobject_p.h:146
QGLFramebufferObjectPrivate::stencil_buffer
GLuint stencil_buffer
Definition:
qglframebufferobject_p.h:145
QGLFramebufferObjectFormatPrivate::QGLFramebufferObjectFormatPrivate
QGLFramebufferObjectFormatPrivate()
Definition:
qglframebufferobject_p.h:75
GLint
typedef GLint
Definition:
glfunctions.h:67
QT_BEGIN_INCLUDE_NAMESPACE
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
Definition:
qglobal.h:91
QGLFramebufferObjectPrivate::engine
QPaintEngine * engine
Definition:
qglframebufferobject_p.h:152
QGLFBOGLPaintDevice
Definition:
qglframebufferobject_p.h:111
QSize
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition:
qsize.h:53
QGLFBOGLPaintDevice::reqAlpha
bool reqAlpha
Definition:
qglframebufferobject_p.h:127
QGLFBOGLPaintDevice::size
virtual QSize size() const
Definition:
qglframebufferobject_p.h:115
QGLFramebufferObjectPrivate::valid
uint valid
Definition:
qglframebufferobject_p.h:150
QGLFramebufferObjectPrivate::QGLFramebufferObjectPrivate
QGLFramebufferObjectPrivate()
Definition:
qglframebufferobject_p.h:133
QGLFramebufferObjectFormat
The QGLFramebufferObjectFormat class specifies the format of an OpenGL framebuffer object...
Definition:
qglframebufferobject.h:140
QGLFramebufferObjectPrivate::size
QSize size
Definition:
qglframebufferobject_p.h:148
QGLFramebufferObjectFormatPrivate::mipmap
uint mipmap
Definition:
qglframebufferobject_p.h:108
QGLFBOGLPaintDevice::alphaRequested
virtual bool alphaRequested() const
Definition:
qglframebufferobject_p.h:118
QGLFramebufferObjectFormatPrivate::internal_format
GLenum internal_format
Definition:
qglframebufferobject_p.h:107
QGLFramebufferObjectFormatPrivate
Definition:
qglframebufferobject_p.h:72
Qt 4.8 Source Code Browser