Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="glBlitFramebuffer"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>2010</year> | |
9 | <holder>Khronos Group</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glBlitFramebuffer</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glBlitFramebuffer</refname> | |
17 | <refpurpose>copy a block of pixels from the read framebuffer to the draw framebuffer</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glBlitFramebuffer</function></funcdef> | |
23 | <paramdef>GLint <parameter>srcX0</parameter></paramdef> | |
24 | <paramdef>GLint <parameter>srcY0</parameter></paramdef> | |
25 | <paramdef>GLint <parameter>srcX1</parameter></paramdef> | |
26 | <paramdef>GLint <parameter>srcY1</parameter></paramdef> | |
27 | <paramdef>GLint <parameter>dstX0</parameter></paramdef> | |
28 | <paramdef>GLint <parameter>dstY0</parameter></paramdef> | |
29 | <paramdef>GLint <parameter>dstX1</parameter></paramdef> | |
30 | <paramdef>GLint <parameter>dstY1</parameter></paramdef> | |
31 | <paramdef>GLbitfield <parameter>mask</parameter></paramdef> | |
32 | <paramdef>GLenum <parameter>filter</parameter></paramdef> | |
33 | </funcprototype> | |
34 | </funcsynopsis> | |
35 | </refsynopsisdiv> | |
36 | <refsect1 id="parameters"><title>Parameters</title> | |
37 | <variablelist> | |
38 | <varlistentry> | |
39 | <term><parameter>srcX0</parameter></term> | |
40 | <term><parameter>srcY0</parameter></term> | |
41 | <term><parameter>srcX1</parameter></term> | |
42 | <term><parameter>srcY1</parameter></term> | |
43 | <listitem> | |
44 | <para> | |
45 | Specify the bounds of the source rectangle within the read buffer of the read framebuffer. | |
46 | </para> | |
47 | </listitem> | |
48 | </varlistentry> | |
49 | <varlistentry> | |
50 | <term><parameter>dstX0</parameter></term> | |
51 | <term><parameter>dstY0</parameter></term> | |
52 | <term><parameter>dstX1</parameter></term> | |
53 | <term><parameter>dstY1</parameter></term> | |
54 | <listitem> | |
55 | <para> | |
56 | Specify the bounds of the destination rectangle within the write buffer of the write framebuffer. | |
57 | </para> | |
58 | </listitem> | |
59 | </varlistentry> | |
60 | <varlistentry> | |
61 | <term><parameter>mask</parameter></term> | |
62 | <listitem> | |
63 | <para> | |
64 | The bitwise OR of the flags indicating which buffers are to be copied. The allowed flags are | |
65 | <constant>GL_COLOR_BUFFER_BIT</constant>, <constant>GL_DEPTH_BUFFER_BIT</constant> and <constant>GL_STENCIL_BUFFER_BIT</constant>. | |
66 | </para> | |
67 | </listitem> | |
68 | </varlistentry> | |
69 | <varlistentry> | |
70 | <term><parameter>filter</parameter></term> | |
71 | <listitem> | |
72 | <para> | |
73 | Specifies the interpolation to be applied if the image is stretched. Must be <constant>GL_NEAREST</constant> or <constant>GL_LINEAR</constant>. | |
74 | </para> | |
75 | </listitem> | |
76 | </varlistentry> | |
77 | </variablelist> | |
78 | </refsect1> | |
79 | <refsect1 id="description"><title>Description</title> | |
80 | <para> | |
81 | <function>glBlitFramebuffer</function> transfers a rectangle of pixel values from one region of the read framebuffer to another region in | |
82 | the draw framebuffer. <parameter>mask</parameter> is the bitwise OR of a number of values indicating which buffers are | |
83 | to be copied. The values are <constant>GL_COLOR_BUFFER_BIT</constant>, <constant>GL_DEPTH_BUFFER_BIT</constant>, and | |
84 | <constant>GL_STENCIL_BUFFER_BIT</constant>. The pixels corresponding to these buffers are copied from the source rectangle bounded by the | |
85 | locations (<parameter>srcX0</parameter>; <parameter>srcY0</parameter>) and (<parameter>srcX1</parameter>; <parameter>srcY1</parameter>) | |
86 | to the destination rectangle bounded by the locations (<parameter>dstX0</parameter>; <parameter>dstY0</parameter>) and | |
87 | (<parameter>dstX1</parameter>; <parameter>dstY1</parameter>). The lower bounds of the rectangle are inclusive, while the upper | |
88 | bounds are exclusive. | |
89 | </para> | |
90 | <para> | |
91 | The actual region taken from the read framebuffer is limited to the intersection of the source buffers being transferred, which may | |
92 | include the color buffer selected by the read buffer, the depth buffer, and/or the stencil buffer depending on mask. The actual region | |
93 | written to the draw framebuffer is limited to the intersection of the destination buffers being written, which may include multiple draw | |
94 | buffers, the depth buffer, and/or the stencil buffer depending on mask. Whether or not the source or destination regions are altered due | |
95 | to these limits, the scaling and offset applied to pixels being transferred is performed as though no such limits were present. | |
96 | </para> | |
97 | <para> | |
98 | If the sizes of the source and destination rectangles are not equal, <parameter>filter</parameter> specifies the interpolation method that | |
99 | will be applied to resize the source image , and must be <constant>GL_NEAREST</constant> or <constant>GL_LINEAR</constant>. | |
100 | <constant>GL_LINEAR</constant> is only a valid interpolation method for the color buffer. If <parameter>filter</parameter> is not | |
101 | <constant>GL_NEAREST</constant> and <parameter>mask</parameter> includes <constant>GL_DEPTH_BUFFER_BIT</constant> or | |
102 | <constant>GL_STENCIL_BUFFER_BIT</constant>, no data is transferred and a <constant>GL_INVALID_OPERATION</constant> error is generated. | |
103 | </para> | |
104 | <para> | |
105 | If <parameter>filter</parameter> is <constant>GL_LINEAR</constant> and the source rectangle would require sampling outside the bounds of | |
106 | the source framebuffer, values are read as if the <constant>GL_CLAMP_TO_EDGE</constant> texture wrapping mode were applied. | |
107 | </para> | |
108 | <para> | |
109 | When the color buffer is transferred, values are taken from the read buffer of the read framebuffer and written to each of the draw | |
110 | buffers of the draw framebuffer. | |
111 | </para> | |
112 | <para> | |
113 | If the source and destination rectangles overlap or are the same, and the read and draw buffers are the same, the result of the operation | |
114 | is undefined. | |
115 | </para> | |
116 | </refsect1> | |
117 | <refsect1 id="errors"><title>Errors</title> | |
118 | <para> | |
119 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mask</parameter> contains any of the <constant>GL_DEPTH_BUFFER_BIT</constant> | |
120 | or <constant>GL_STENCIL_BUFFER_BIT</constant> and <parameter>filter</parameter> is not <constant>GL_NEAREST</constant>. | |
121 | </para> | |
122 | <para> | |
123 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mask</parameter> contains <constant>GL_COLOR_BUFFER_BIT</constant> | |
124 | and any of the following conditions hold: | |
125 | <itemizedlist> | |
126 | <listitem> | |
127 | <para>The read buffer contains fixed-point or floating-point values and any draw buffer contains | |
128 | neither fixed-point nor floating-point values.</para> | |
129 | </listitem> | |
130 | <listitem> | |
131 | <para>The read buffer contains unsigned integer values and any draw buffer does not contain unsigned | |
132 | integer values.</para> | |
133 | </listitem> | |
134 | <listitem> | |
135 | <para>The read buffer contains signed integer values and any draw buffer does not contain signed integer values.</para> | |
136 | </listitem> | |
137 | </itemizedlist> | |
138 | </para> | |
139 | <para> | |
140 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mask</parameter> contains <constant>GL_DEPTH_BUFFER_BIT</constant> or | |
141 | <constant>GL_STENCIL_BUFFER_BIT</constant> and the source and destination depth and stencil formats do not match. | |
142 | </para> | |
143 | <para> | |
144 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>filter</parameter> is <constant>GL_LINEAR</constant> and the read buffer | |
145 | contains integer data. | |
146 | </para> | |
147 | <para> | |
148 | <constant>GL_INVALID_OPERATION</constant> is generated if the value of <parameter>GL_SAMPLES</parameter> for the read and draw buffers is | |
149 | not identical. | |
150 | </para> | |
151 | <para> | |
152 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>GL_SAMPLE_BUFFERS</parameter> for both read and draw buffers greater than | |
153 | zero and the dimensions of the source and destination rectangles is not identical. | |
154 | </para> | |
155 | <para> | |
156 | <constant>GL_INVALID_FRAMEBUFFER_OPERATION</constant> is generated if the objects bound to <constant>GL_DRAW_FRAMEBUFFER_BINDING</constant> | |
157 | or <constant>GL_READ_FRAMEBUFFER_BINDING</constant> are not framebuffer complete. | |
158 | </para> | |
159 | </refsect1> | |
160 | <refsect1 id="seealso"><title>See Also</title> | |
161 | <para> | |
162 | <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry> | |
163 | <citerefentry><refentrytitle>glCheckFramebufferStatus</refentrytitle></citerefentry>, | |
164 | <citerefentry><refentrytitle>glGenFramebuffers</refentrytitle></citerefentry> | |
165 | <citerefentry><refentrytitle>glBindFramebuffer</refentrytitle></citerefentry> | |
166 | <citerefentry><refentrytitle>glDeleteFramebuffers</refentrytitle></citerefentry> | |
167 | </para> | |
168 | </refsect1> | |
169 | <refsect1 id="Copyright"><title>Copyright</title> | |
170 | <para> | |
171 | Copyright <trademark class="copyright"></trademark> 2010 Khronos Group. | |
172 | This material may be distributed subject to the terms and conditions set forth in | |
173 | the Open Publication License, v 1.0, 8 June 1999. | |
174 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
175 | </para> | |
176 | </refsect1> | |
177 | </refentry> |