102f4aeb0Sopenharmony_ci<?xml version="1.0" encoding="UTF-8" standalone="no"?>
202f4aeb0Sopenharmony_ci<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
302f4aeb0Sopenharmony_ci  <head>
402f4aeb0Sopenharmony_ci    <title xmlns:xlink="http://www.w3.org/1999/xlink">eglSwapBuffers - EGL Reference Pages</title>
502f4aeb0Sopenharmony_ci    <link rel="stylesheet" type="text/css" href="khronos-man.css"/>
602f4aeb0Sopenharmony_ci    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>
702f4aeb0Sopenharmony_ci  </head>
802f4aeb0Sopenharmony_ci  <body>
902f4aeb0Sopenharmony_ci    <header/>
1002f4aeb0Sopenharmony_ci    <div class="refentry" id="eglSwapBuffers">
1102f4aeb0Sopenharmony_ci      <div class="titlepage"/>
1202f4aeb0Sopenharmony_ci      <div class="refnamediv">
1302f4aeb0Sopenharmony_ci        <h2>Name</h2>
1402f4aeb0Sopenharmony_ci        <p>eglSwapBuffers — 
1502f4aeb0Sopenharmony_ci            post <abbr class="acronym">EGL</abbr> surface color buffer to a native window
1602f4aeb0Sopenharmony_ci        </p>
1702f4aeb0Sopenharmony_ci      </div>
1802f4aeb0Sopenharmony_ci      <div class="refsynopsisdiv">
1902f4aeb0Sopenharmony_ci        <h2>C Specification</h2>
2002f4aeb0Sopenharmony_ci        <div class="funcsynopsis">
2102f4aeb0Sopenharmony_ci          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
2202f4aeb0Sopenharmony_ci            <tr>
2302f4aeb0Sopenharmony_ci              <td>
2402f4aeb0Sopenharmony_ci                <code class="funcdef">EGLBoolean <strong class="fsfunc">eglSwapBuffers</strong>(</code>
2502f4aeb0Sopenharmony_ci              </td>
2602f4aeb0Sopenharmony_ci              <td>EGLDisplay <var class="pdparam">display</var>, </td>
2702f4aeb0Sopenharmony_ci            </tr>
2802f4aeb0Sopenharmony_ci            <tr>
2902f4aeb0Sopenharmony_ci              <td> </td>
3002f4aeb0Sopenharmony_ci              <td>EGLSurface <var class="pdparam">surface</var><code>)</code>;</td>
3102f4aeb0Sopenharmony_ci            </tr>
3202f4aeb0Sopenharmony_ci          </table>
3302f4aeb0Sopenharmony_ci          <div class="funcprototype-spacer"> </div>
3402f4aeb0Sopenharmony_ci        </div>
3502f4aeb0Sopenharmony_ci      </div>
3602f4aeb0Sopenharmony_ci      <div class="refsect1" id="parameters">
3702f4aeb0Sopenharmony_ci        <h2>Parameters</h2>
3802f4aeb0Sopenharmony_ci        <div class="variablelist">
3902f4aeb0Sopenharmony_ci          <dl class="variablelist">
4002f4aeb0Sopenharmony_ci            <dt>
4102f4aeb0Sopenharmony_ci              <span class="term">
4202f4aeb0Sopenharmony_ci                <em class="parameter">
4302f4aeb0Sopenharmony_ci                  <code>display</code>
4402f4aeb0Sopenharmony_ci                </em>
4502f4aeb0Sopenharmony_ci              </span>
4602f4aeb0Sopenharmony_ci            </dt>
4702f4aeb0Sopenharmony_ci            <dd>
4802f4aeb0Sopenharmony_ci              <p>
4902f4aeb0Sopenharmony_ci                        Specifies the EGL display connection.
5002f4aeb0Sopenharmony_ci                    </p>
5102f4aeb0Sopenharmony_ci            </dd>
5202f4aeb0Sopenharmony_ci            <dt>
5302f4aeb0Sopenharmony_ci              <span class="term">
5402f4aeb0Sopenharmony_ci                <em class="parameter">
5502f4aeb0Sopenharmony_ci                  <code>surface</code>
5602f4aeb0Sopenharmony_ci                </em>
5702f4aeb0Sopenharmony_ci              </span>
5802f4aeb0Sopenharmony_ci            </dt>
5902f4aeb0Sopenharmony_ci            <dd>
6002f4aeb0Sopenharmony_ci              <p>
6102f4aeb0Sopenharmony_ci                        Specifies the EGL drawing surface whose buffers are to be swapped.
6202f4aeb0Sopenharmony_ci                    </p>
6302f4aeb0Sopenharmony_ci            </dd>
6402f4aeb0Sopenharmony_ci          </dl>
6502f4aeb0Sopenharmony_ci        </div>
6602f4aeb0Sopenharmony_ci      </div>
6702f4aeb0Sopenharmony_ci      <div class="refsect1" id="description">
6802f4aeb0Sopenharmony_ci        <h2>Description</h2>
6902f4aeb0Sopenharmony_ci        <p>
7002f4aeb0Sopenharmony_ci            If <em class="parameter"><code>surface</code></em> is a back-buffered window
7102f4aeb0Sopenharmony_ci            surface, then the color
7202f4aeb0Sopenharmony_ci            buffer is copied (posted) to the native window associated with that
7302f4aeb0Sopenharmony_ci            surface. If <em class="parameter"><code>surface</code></em> is a single-buffered
7402f4aeb0Sopenharmony_ci            window, pixmap, or pixel buffer surface,
7502f4aeb0Sopenharmony_ci            <code class="function">eglSwapBuffers</code> has no effect.
7602f4aeb0Sopenharmony_ci        </p>
7702f4aeb0Sopenharmony_ci        <p>
7802f4aeb0Sopenharmony_ci            The contents of ancillary buffers are always undefined after
7902f4aeb0Sopenharmony_ci            calling <code class="function">eglSwapBuffers</code>. The contents of the
8002f4aeb0Sopenharmony_ci            color buffer are undefined if the value of the
8102f4aeb0Sopenharmony_ci            <code class="constant">EGL_SWAP_BEHAVIOR</code> attribute of
8202f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> is not
8302f4aeb0Sopenharmony_ci            <code class="constant">EGL_BUFFER_PRESERVED</code>. The value of
8402f4aeb0Sopenharmony_ci            <code class="constant">EGL_SWAP_BEHAVIOR</code> can be set for some
8502f4aeb0Sopenharmony_ci            surfaces using
8602f4aeb0Sopenharmony_ci            <a class="citerefentry" href="eglSurfaceAttrib.xhtml"><span class="citerefentry"><span class="refentrytitle">eglSurfaceAttrib</span></span></a>.
8702f4aeb0Sopenharmony_ci            <code class="constant">EGL_SWAP_BEHAVIOR</code> applies only to the color
8802f4aeb0Sopenharmony_ci            buffer. EGL has no way to specify or query whether or not
8902f4aeb0Sopenharmony_ci            ancillary buffers are preserved, and applications should not
9002f4aeb0Sopenharmony_ci            rely on this behavior.
9102f4aeb0Sopenharmony_ci        </p>
9202f4aeb0Sopenharmony_ci        <p>
9302f4aeb0Sopenharmony_ci            <code class="function">eglSwapBuffers</code> performs an implicit
9402f4aeb0Sopenharmony_ci            flush operation on the context (<code class="function">glFlush</code>
9502f4aeb0Sopenharmony_ci            for an OpenGL ES or OpenGL context,
9602f4aeb0Sopenharmony_ci            <code class="function">vgFlush</code> for an OpenVG context) bound to
9702f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> before swapping. Subsequent
9802f4aeb0Sopenharmony_ci            client API commands may be issued on that context
9902f4aeb0Sopenharmony_ci            immediately after calling
10002f4aeb0Sopenharmony_ci            <code class="function">eglSwapBuffers</code>, but are not executed
10102f4aeb0Sopenharmony_ci            until the buffer exchange is completed.
10202f4aeb0Sopenharmony_ci        </p>
10302f4aeb0Sopenharmony_ci      </div>
10402f4aeb0Sopenharmony_ci      <div class="refsect1" id="resize">
10502f4aeb0Sopenharmony_ci        <h2>Native Window Resizing</h2>
10602f4aeb0Sopenharmony_ci        <p>
10702f4aeb0Sopenharmony_ci            If the native window corresponding to
10802f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> has been resized prior to the
10902f4aeb0Sopenharmony_ci            swap, <em class="parameter"><code>surface</code></em> must be resized to match.
11002f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> will normally be resized by the
11102f4aeb0Sopenharmony_ci            EGL implementation at the time the native window is resized. If
11202f4aeb0Sopenharmony_ci            the implementation cannot do this transparently to the client,
11302f4aeb0Sopenharmony_ci            then <code class="function">eglSwapBuffers</code> must detect the change
11402f4aeb0Sopenharmony_ci            and resize surface prior to copying its pixels to the native
11502f4aeb0Sopenharmony_ci            window. If <em class="parameter"><code>surface</code></em> shrinks as a result of
11602f4aeb0Sopenharmony_ci            resizing, some rendered pixels are lost. If
11702f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> grows, the newly allocated buffer
11802f4aeb0Sopenharmony_ci            contents are undefined. The resizing behavior described here
11902f4aeb0Sopenharmony_ci            only maintains consistency of EGL surfaces and native windows;
12002f4aeb0Sopenharmony_ci            clients are still responsible for detecting window size changes
12102f4aeb0Sopenharmony_ci            (using platform-specific means) and changing their viewport and
12202f4aeb0Sopenharmony_ci            scissor regions accordingly.
12302f4aeb0Sopenharmony_ci        </p>
12402f4aeb0Sopenharmony_ci      </div>
12502f4aeb0Sopenharmony_ci      <div class="refsect1" id="notes">
12602f4aeb0Sopenharmony_ci        <h2>Notes</h2>
12702f4aeb0Sopenharmony_ci        <p>
12802f4aeb0Sopenharmony_ci            Attribute <code class="constant">EGL_SWAP_BEHAVIOR</code> is supported
12902f4aeb0Sopenharmony_ci            only if the EGL version is 1.2 or greater. In earlier versions,
13002f4aeb0Sopenharmony_ci            behavior is as though the attribute exists, and always has the
13102f4aeb0Sopenharmony_ci            value <code class="constant">EGL_BUFFER_DESTROYED</code>.
13202f4aeb0Sopenharmony_ci        </p>
13302f4aeb0Sopenharmony_ci        <p>
13402f4aeb0Sopenharmony_ci            The EGL 1.4 specification was updated to acknowledge that
13502f4aeb0Sopenharmony_ci            ancillary buffers are not necessarily preserved after a swap,
13602f4aeb0Sopenharmony_ci            and that the <code class="constant">EGL_SWAP_BEHAVIOR</code> attribute
13702f4aeb0Sopenharmony_ci            applies only to the color buffer. This change in the
13802f4aeb0Sopenharmony_ci            specification acknowledged the behavior of many shipping
13902f4aeb0Sopenharmony_ci            implementations, and is not intended to result in behavior
14002f4aeb0Sopenharmony_ci            changes in any existing implementation.
14102f4aeb0Sopenharmony_ci        </p>
14202f4aeb0Sopenharmony_ci      </div>
14302f4aeb0Sopenharmony_ci      <div class="refsect1" id="errors">
14402f4aeb0Sopenharmony_ci        <h2>Errors</h2>
14502f4aeb0Sopenharmony_ci        <p>
14602f4aeb0Sopenharmony_ci            <code class="constant">EGL_FALSE</code> is returned if swapping of the
14702f4aeb0Sopenharmony_ci            surface buffers fails, <code class="constant">EGL_TRUE</code> otherwise.
14802f4aeb0Sopenharmony_ci        </p>
14902f4aeb0Sopenharmony_ci        <p>
15002f4aeb0Sopenharmony_ci            <code class="constant">EGL_BAD_DISPLAY</code> is generated if
15102f4aeb0Sopenharmony_ci            <em class="parameter"><code>display</code></em> is not an EGL display connection.
15202f4aeb0Sopenharmony_ci        </p>
15302f4aeb0Sopenharmony_ci        <p>
15402f4aeb0Sopenharmony_ci            <code class="constant">EGL_NOT_INITIALIZED</code> is generated if
15502f4aeb0Sopenharmony_ci            <em class="parameter"><code>display</code></em> has not been initialized.
15602f4aeb0Sopenharmony_ci        </p>
15702f4aeb0Sopenharmony_ci        <p>
15802f4aeb0Sopenharmony_ci            <code class="constant">EGL_BAD_SURFACE</code> is generated if
15902f4aeb0Sopenharmony_ci            <em class="parameter"><code>surface</code></em> is not an EGL drawing surface.
16002f4aeb0Sopenharmony_ci        </p>
16102f4aeb0Sopenharmony_ci        <p>
16202f4aeb0Sopenharmony_ci            <code class="constant">EGL_CONTEXT_LOST</code> is generated if a power management
16302f4aeb0Sopenharmony_ci            event has occurred. The application must destroy all contexts and
16402f4aeb0Sopenharmony_ci            reinitialise OpenGL ES state and objects to continue rendering.
16502f4aeb0Sopenharmony_ci        </p>
16602f4aeb0Sopenharmony_ci      </div>
16702f4aeb0Sopenharmony_ci      <div class="refsect1" id="seealso">
16802f4aeb0Sopenharmony_ci        <h2>See Also</h2>
16902f4aeb0Sopenharmony_ci        <p>
17002f4aeb0Sopenharmony_ci            <code class="function">glFlush</code>,
17102f4aeb0Sopenharmony_ci            <a class="citerefentry" href="eglCopyBuffers.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCopyBuffers</span></span></a>,
17202f4aeb0Sopenharmony_ci            <code class="function">vgFlush</code>
17302f4aeb0Sopenharmony_ci        </p>
17402f4aeb0Sopenharmony_ci      </div>
17502f4aeb0Sopenharmony_ci      <p>
17602f4aeb0Sopenharmony_ci    </p>
17702f4aeb0Sopenharmony_ci      <div class="refsect3" id="copyright">
17802f4aeb0Sopenharmony_ci        <img src="KhronosLogo.jpg"/>
17902f4aeb0Sopenharmony_ci        <p>
18002f4aeb0Sopenharmony_ci            Copyright © 2003-2014 The Khronos Group Inc.
18102f4aeb0Sopenharmony_ci            Permission is hereby granted, free of charge, to any person obtaining a
18202f4aeb0Sopenharmony_ci            copy of this software and/or associated documentation files (the
18302f4aeb0Sopenharmony_ci            "Materials"), to deal in the Materials without restriction, including
18402f4aeb0Sopenharmony_ci            without limitation the rights to use, copy, modify, merge, publish,
18502f4aeb0Sopenharmony_ci            distribute, sublicense, and/or sell copies of the Materials, and to
18602f4aeb0Sopenharmony_ci            permit persons to whom the Materials are furnished to do so, subject to
18702f4aeb0Sopenharmony_ci            the condition that this copyright notice and permission notice shall be included
18802f4aeb0Sopenharmony_ci            in all copies or substantial portions of the Materials.
18902f4aeb0Sopenharmony_ci        </p>
19002f4aeb0Sopenharmony_ci      </div>
19102f4aeb0Sopenharmony_ci      <p>
19202f4aeb0Sopenharmony_ci</p>
19302f4aeb0Sopenharmony_ci    </div>
19402f4aeb0Sopenharmony_ci    <footer/>
19502f4aeb0Sopenharmony_ci  </body>
19602f4aeb0Sopenharmony_ci</html>
197