blob: 8b9a0aa30343bf1574dc88f2c41fdd39950a90f3 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title xmlns:xlink="http://www.w3.org/1999/xlink">eglSwapBuffers - EGL Reference Pages</title>
<link rel="stylesheet" type="text/css" href="khronos-man.css"/>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>
</head>
<body>
<header/>
<div class="refentry" id="eglSwapBuffers">
<div class="titlepage"/>
<div class="refnamediv">
<h2>Name</h2>
<p>eglSwapBuffers —
post <abbr class="acronym">EGL</abbr> surface color buffer to a native window
</p>
</div>
<div class="refsynopsisdiv">
<h2>C Specification</h2>
<div class="funcsynopsis">
<table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
<tr>
<td>
<code class="funcdef">EGLBoolean <strong class="fsfunc">eglSwapBuffers</strong>(</code>
</td>
<td>EGLDisplay <var class="pdparam">display</var>, </td>
</tr>
<tr>
<td> </td>
<td>EGLSurface <var class="pdparam">surface</var><code>)</code>;</td>
</tr>
</table>
<div class="funcprototype-spacer"> </div>
</div>
</div>
<div class="refsect1" id="parameters">
<h2>Parameters</h2>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<em class="parameter">
<code>display</code>
</em>
</span>
</dt>
<dd>
<p>
Specifies the EGL display connection.
</p>
</dd>
<dt>
<span class="term">
<em class="parameter">
<code>surface</code>
</em>
</span>
</dt>
<dd>
<p>
Specifies the EGL drawing surface whose buffers are to be swapped.
</p>
</dd>
</dl>
</div>
</div>
<div class="refsect1" id="description">
<h2>Description</h2>
<p>
If <em class="parameter"><code>surface</code></em> is a back-buffered window
surface, <code class="function">eglSwapBuffers</code> then the color
buffer is copied (posted) native window associated with that
surface. If <em class="parameter"><code>surface</code></em> is a single-buffered
window, pixmap, or pixel buffer surface,
<code class="function">eglSwapBuffers</code> has no effect.
</p>
<p>
The contents of ancillary buffers are always undefined after
calling <code class="function">eglSwapBuffers</code>. The contents of the
color buffer are undefined if the value of the
<code class="constant">EGL_SWAP_BEHAVIOR</code> attribute of
<em class="parameter"><code>surface</code></em> is not
<code class="constant">EGL_BUFFER_PRESERVED</code>. The value of
<code class="constant">EGL_SWAP_BEHAVIOR</code> can be set for some
surfaces using
<a class="citerefentry" href="eglSurfaceAttrib.xhtml"><span class="citerefentry"><span class="refentrytitle">eglSurfaceAttrib</span></span></a>.
<code class="constant">EGL_SWAP_BEHAVIOR</code> applies only to the color
buffer. EGL has no way to specify or query whether or not
ancillary buffers are preserved, and applications should not
rely on this behavior.
</p>
<p>
<code class="function">eglSwapBuffers</code> performs an implicit
flush operation on the context (<code class="function">glFlush</code>
for an OpenGL ES or OpenGL context,
<code class="function">vgFlush</code> for an OpenVG context) bound to
<em class="parameter"><code>surface</code></em> before swapping. Subsequent
client API commands may be issued on that context
immediately after calling
<code class="function">eglSwapBuffers</code>, but are not executed
until the buffer exchange is completed.
</p>
</div>
<div class="refsect1" id="resize">
<h2>Native Window Resizing</h2>
<p>
If the native window corresponding to
<em class="parameter"><code>surface</code></em> has been resized prior to the
swap, <em class="parameter"><code>surface</code></em> must be resized to match.
<em class="parameter"><code>surface</code></em> will normally be resized by the
EGL implementation at the time the native window is resized. If
the implementation cannot do this transparently to the client,
then <code class="function">eglSwapBuffers</code> must detect the change
and resize surface prior to copying its pixels to the native
window. If <em class="parameter"><code>surface</code></em> shrinks as a result of
resizing, some rendered pixels are lost. If
<em class="parameter"><code>surface</code></em> grows, the newly allocated buffer
contents are undefined. The resizing behavior described here
only maintains consistency of EGL surfaces and native windows;
clients are still responsible for detecting window size changes
(using platform-specific means) and changing their viewport and
scissor regions accordingly.
</p>
</div>
<div class="refsect1" id="notes">
<h2>Notes</h2>
<p>
Attribute <code class="constant">EGL_SWAP_BEHAVIOR</code> is supported
only if the EGL version is 1.2 or greater. In earlier versions,
behavior is as though the attribute exists, and always has the
value <code class="constant">EGL_BUFFER_DESTROYED</code>.
</p>
<p>
The EGL 1.4 specification was updated to acknowledge that
ancillary buffers are not necessarily preserved after a swap,
and that the <code class="constant">EGL_SWAP_BEHAVIOR</code> attribute
applies only to the color buffer. This change in the
specification acknowledged the behavior of many shipping
implementations, and is not intended to result in behavior
changes in any existing implementation.
</p>
</div>
<div class="refsect1" id="errors">
<h2>Errors</h2>
<p>
<code class="constant">EGL_FALSE</code> is returned if swapping of the
surface buffers fails, <code class="constant">EGL_TRUE</code> otherwise.
</p>
<p>
<code class="constant">EGL_BAD_DISPLAY</code> is generated if
<em class="parameter"><code>display</code></em> is not an EGL display connection.
</p>
<p>
<code class="constant">EGL_NOT_INITIALIZED</code> is generated if
<em class="parameter"><code>display</code></em> has not been initialized.
</p>
<p>
<code class="constant">EGL_BAD_SURFACE</code> is generated if
<em class="parameter"><code>surface</code></em> is not an EGL drawing surface.
</p>
<p>
<code class="constant">EGL_CONTEXT_LOST</code> is generated if a power management
event has occurred. The application must destroy all contexts and
reinitialise OpenGL ES state and objects to continue rendering.
</p>
</div>
<div class="refsect1" id="seealso">
<h2>See Also</h2>
<p>
<code class="function">glFlush</code>,
<a class="citerefentry" href="eglCopyBuffers.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCopyBuffers</span></span></a>,
<code class="function">vgFlush</code>
</p>
</div>
<p>
</p>
<div class="refsect3" id="copyright">
<img src="KhronosLogo.jpg"/>
<p>
Copyright © 2003-2014 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the condition that this copyright notice and permission notice shall be included
in all copies or substantial portions of the Materials.
</p>
</div>
<p>
</p>
</div>
<footer/>
</body>
</html>