1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title xmlns:xlink="http://www.w3.org/1999/xlink">eglSwapBuffers - EGL Reference Pages</title> 5 <link rel="stylesheet" type="text/css" href="khronos-man.css"/> 6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/> 7 </head> 8 <body> 9 <header/> 10 <div class="refentry" id="eglSwapBuffers"> 11 <div class="titlepage"/> 12 <div class="refnamediv"> 13 <h2>Name</h2> 14 <p>eglSwapBuffers — 15 post <abbr class="acronym">EGL</abbr> surface color buffer to a native window 16 </p> 17 </div> 18 <div class="refsynopsisdiv"> 19 <h2>C Specification</h2> 20 <div class="funcsynopsis"> 21 <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table"> 22 <tr> 23 <td> 24 <code class="funcdef">EGLBoolean <strong class="fsfunc">eglSwapBuffers</strong>(</code> 25 </td> 26 <td>EGLDisplay <var class="pdparam">display</var>, </td> 27 </tr> 28 <tr> 29 <td> </td> 30 <td>EGLSurface <var class="pdparam">surface</var><code>)</code>;</td> 31 </tr> 32 </table> 33 <div class="funcprototype-spacer"> </div> 34 </div> 35 </div> 36 <div class="refsect1" id="parameters"> 37 <h2>Parameters</h2> 38 <div class="variablelist"> 39 <dl class="variablelist"> 40 <dt> 41 <span class="term"> 42 <em class="parameter"> 43 <code>display</code> 44 </em> 45 </span> 46 </dt> 47 <dd> 48 <p> 49 Specifies the EGL display connection. 50 </p> 51 </dd> 52 <dt> 53 <span class="term"> 54 <em class="parameter"> 55 <code>surface</code> 56 </em> 57 </span> 58 </dt> 59 <dd> 60 <p> 61 Specifies the EGL drawing surface whose buffers are to be swapped. 62 </p> 63 </dd> 64 </dl> 65 </div> 66 </div> 67 <div class="refsect1" id="description"> 68 <h2>Description</h2> 69 <p> 70 If <em class="parameter"><code>surface</code></em> is a back-buffered window 71 surface, then the color 72 buffer is copied (posted) to the native window associated with that 73 surface. If <em class="parameter"><code>surface</code></em> is a single-buffered 74 window, pixmap, or pixel buffer surface, 75 <code class="function">eglSwapBuffers</code> has no effect. 76 </p> 77 <p> 78 The contents of ancillary buffers are always undefined after 79 calling <code class="function">eglSwapBuffers</code>. The contents of the 80 color buffer are undefined if the value of the 81 <code class="constant">EGL_SWAP_BEHAVIOR</code> attribute of 82 <em class="parameter"><code>surface</code></em> is not 83 <code class="constant">EGL_BUFFER_PRESERVED</code>. The value of 84 <code class="constant">EGL_SWAP_BEHAVIOR</code> can be set for some 85 surfaces using 86 <a class="citerefentry" href="eglSurfaceAttrib.xhtml"><span class="citerefentry"><span class="refentrytitle">eglSurfaceAttrib</span></span></a>. 87 <code class="constant">EGL_SWAP_BEHAVIOR</code> applies only to the color 88 buffer. EGL has no way to specify or query whether or not 89 ancillary buffers are preserved, and applications should not 90 rely on this behavior. 91 </p> 92 <p> 93 <code class="function">eglSwapBuffers</code> performs an implicit 94 flush operation on the context (<code class="function">glFlush</code> 95 for an OpenGL ES or OpenGL context, 96 <code class="function">vgFlush</code> for an OpenVG context) bound to 97 <em class="parameter"><code>surface</code></em> before swapping. Subsequent 98 client API commands may be issued on that context 99 immediately after calling 100 <code class="function">eglSwapBuffers</code>, but are not executed 101 until the buffer exchange is completed. 102 </p> 103 </div> 104 <div class="refsect1" id="resize"> 105 <h2>Native Window Resizing</h2> 106 <p> 107 If the native window corresponding to 108 <em class="parameter"><code>surface</code></em> has been resized prior to the 109 swap, <em class="parameter"><code>surface</code></em> must be resized to match. 110 <em class="parameter"><code>surface</code></em> will normally be resized by the 111 EGL implementation at the time the native window is resized. If 112 the implementation cannot do this transparently to the client, 113 then <code class="function">eglSwapBuffers</code> must detect the change 114 and resize surface prior to copying its pixels to the native 115 window. If <em class="parameter"><code>surface</code></em> shrinks as a result of 116 resizing, some rendered pixels are lost. If 117 <em class="parameter"><code>surface</code></em> grows, the newly allocated buffer 118 contents are undefined. The resizing behavior described here 119 only maintains consistency of EGL surfaces and native windows; 120 clients are still responsible for detecting window size changes 121 (using platform-specific means) and changing their viewport and 122 scissor regions accordingly. 123 </p> 124 </div> 125 <div class="refsect1" id="notes"> 126 <h2>Notes</h2> 127 <p> 128 Attribute <code class="constant">EGL_SWAP_BEHAVIOR</code> is supported 129 only if the EGL version is 1.2 or greater. In earlier versions, 130 behavior is as though the attribute exists, and always has the 131 value <code class="constant">EGL_BUFFER_DESTROYED</code>. 132 </p> 133 <p> 134 The EGL 1.4 specification was updated to acknowledge that 135 ancillary buffers are not necessarily preserved after a swap, 136 and that the <code class="constant">EGL_SWAP_BEHAVIOR</code> attribute 137 applies only to the color buffer. This change in the 138 specification acknowledged the behavior of many shipping 139 implementations, and is not intended to result in behavior 140 changes in any existing implementation. 141 </p> 142 </div> 143 <div class="refsect1" id="errors"> 144 <h2>Errors</h2> 145 <p> 146 <code class="constant">EGL_FALSE</code> is returned if swapping of the 147 surface buffers fails, <code class="constant">EGL_TRUE</code> otherwise. 148 </p> 149 <p> 150 <code class="constant">EGL_BAD_DISPLAY</code> is generated if 151 <em class="parameter"><code>display</code></em> is not an EGL display connection. 152 </p> 153 <p> 154 <code class="constant">EGL_NOT_INITIALIZED</code> is generated if 155 <em class="parameter"><code>display</code></em> has not been initialized. 156 </p> 157 <p> 158 <code class="constant">EGL_BAD_SURFACE</code> is generated if 159 <em class="parameter"><code>surface</code></em> is not an EGL drawing surface. 160 </p> 161 <p> 162 <code class="constant">EGL_CONTEXT_LOST</code> is generated if a power management 163 event has occurred. The application must destroy all contexts and 164 reinitialise OpenGL ES state and objects to continue rendering. 165 </p> 166 </div> 167 <div class="refsect1" id="seealso"> 168 <h2>See Also</h2> 169 <p> 170 <code class="function">glFlush</code>, 171 <a class="citerefentry" href="eglCopyBuffers.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCopyBuffers</span></span></a>, 172 <code class="function">vgFlush</code> 173 </p> 174 </div> 175 <p> 176 </p> 177 <div class="refsect3" id="copyright"> 178 <img src="KhronosLogo.jpg"/> 179 <p> 180 Copyright © 2003-2014 The Khronos Group Inc. 181 Permission is hereby granted, free of charge, to any person obtaining a 182 copy of this software and/or associated documentation files (the 183 "Materials"), to deal in the Materials without restriction, including 184 without limitation the rights to use, copy, modify, merge, publish, 185 distribute, sublicense, and/or sell copies of the Materials, and to 186 permit persons to whom the Materials are furnished to do so, subject to 187 the condition that this copyright notice and permission notice shall be included 188 in all copies or substantial portions of the Materials. 189 </p> 190 </div> 191 <p> 192</p> 193 </div> 194 <footer/> 195 </body> 196</html> 197