• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
3<!-- saved from url=(0013)about:internet -->
4<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" xmlns:xlink="http://www.w3.org/1999/xlink" pref:renderer="mathplayer-dl">
5  <head>
6    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7    <style xmlns="" type="text/css">
8    /* This style sets a margin around the entire page */
9        html, body {
10            margin: 10px;
11        }
12
13        p {
14            font: normal 16px verdana, sans-serif;
15            margin: 0;
16            padding-bottom:12px;
17        }
18
19        h1 {
20            font: bold 25px verdana, sans-serif;
21            margin-top: 0;
22            margin-bottom: 3px;
23            padding-top: 0;
24            padding-bottom: 0;
25        }
26
27        h2 {
28            font: bold 19px verdana, sans-serif;
29            margin-top: 28px;
30            margin-bottom: 3px;
31            padding-top: 0;
32            padding-bottom: 0;
33        }
34
35        h3 {
36            font: bold 19px verdana, sans-serif !important;
37            margin-top: 28px;
38            margin-bottom: 3px;
39            padding-top: 0;
40            padding-bottom: 0;
41        }
42
43        li {
44            font: normal 16px verdana, sans-serif;
45            margin-top: 0;
46            margin-bottom: 18px;
47            padding-top: 0;
48            padding-bottom: 0;
49        }
50
51        .pdparam {
52            font: italic 16px verdana, sans-serif;
53        }
54
55                .term {
56                        font: italic 16px verdana, sans-serif;
57                        font-weight: normal;
58                }
59
60                .type {
61                        font: normal 16px verdana, sans-serif !important;
62                }
63
64                .parameter {
65                        font-style: italic;
66                        }
67
68        a:link, a:visited {
69            color: blue;
70            text-decoration: none;
71            font: normal 16px;
72        }
73
74        a:hover {
75            background-color: #FFFF99;
76            font: normal 16px;
77        }
78
79        div.funcsynopsis {
80            text-align: left;
81            background-color: #e6e6e6;
82            font: normal 16px verdana, sans-serif;
83                        padding-top: 10px;
84                        padding-bottom: 10px;
85        }
86
87        div.funcsynopsis table {
88            border-collapse: separate;
89            font: normal 16px verdana, sans-serif;
90        }
91
92        div.funcsynopsis td {
93            background-color: #e6e6e6;
94            border: 0 solid #000;
95            padding: 1px;
96            font: normal 16px verdana, sans-serif;
97        }
98
99        div.refsect1 {
100            font-family: verdana, sans-serif;
101            font-size: 16px;
102        }
103
104        code.constant {
105            font: normal 16px courier new, monospace !important;
106        }
107
108                span.errorname {
109            font: normal 16px verdana, sans-serif !important;
110        }
111
112        code.function {
113            font: bold 16px verdana, sans-serif !important;
114        }
115
116        b.fsfunc {
117            font: bold 16px verdana, sans-serif !important;
118        }
119
120        code.varname {
121            font: italic 16px verdana, sans-serif;
122        }
123
124        code.replaceable {
125            font: italic 16px courier new, monospace;
126        }
127
128        code.funcdef {
129            font: normal 16px verdana, sans-serif !important;
130        }
131
132        .citerefentry {
133            font: normal 16px verdana, sans-serif !important;
134        }
135
136        .parameter {
137            font-style: italic;
138        }
139
140        code.fsfunc {
141            font: normal 16px verdana, sans-serif !important;
142        }
143
144        /* PARAMETER: This style controls spacing between the terms in Parameter section */
145        dt {
146            margin-top: 15px;
147        }
148
149        /* TABLES: These styles apply to all tables OTHER than the Synopsis and Example tables */
150        div.refsect1 table {
151            width: 100%;
152                        margin-top: 10px;
153            background-color: #FFF;
154                        border-collapse: collapse;
155                        border-color: #000;
156            border-width: 1px;
157                        font: normal 16px verdana, sans-serif;
158        }
159
160        div.refsect1 th {
161                        border-collapse: collapse;
162                        border-color: #000;
163            border-width: 1px;
164            font: bold 16px verdana, sans-serif;
165        }
166
167        div.refsect1 td {
168            background-color: #FFF;
169            padding: 5px;
170            vertical-align: text-top;
171                        border-collapse: collapse;
172                        border-color: #000;
173            border-width: 1px;
174            font: normal 16px verdana, sans-serif;
175        }
176
177                  div.refsect1 p{
178            font: normal 16px verdana, sans-serif;
179            margin-top: 8px;
180            margin-bottom: 8px;
181            padding-top: 0;
182            padding-bottom: 0;
183        }
184
185
186        /* EXAMPLE: These styles apply only to the Example section */
187        div.refsect2 {
188            font: normal 16px courier new, monospace !important;
189        }
190
191        div.refsect2 table {
192            margin-top: 0;
193            background-color: #e6e6e6;
194            width: 100%;
195            border: 0 solid #000;
196            padding: 2px;
197            font: normal 16px courier new, monospace !important;
198        }
199
200        div.refsect2 td {
201            background-color: #e6e6e6;
202            font: normal 16px courier new, monospace !important;
203                        white-space:pre;
204        }
205
206        /* COPYRIGHT: This style formats the text of the copyright statement at the bottom of the page */
207        div.refsect3 {
208            font: normal 11px verdana, sans-serif;
209            margin-top: 50px;
210            margin-bottom: 20px;
211            padding-top: 0;
212            padding-bottom: 0;
213        }
214
215</style>
216    <title>eglIntro</title>
217    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
218  </head>
219  <body>
220    <div class="refentry">
221      <a id="eglIntro"></a>
222      <div class="titlepage"></div>
223      <div xmlns="" class="refnamediv">
224        <h1>eglIntro</h1>
225        <p>
226            introduction to managing client API rendering through the
227            <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">EGL</acronym> API.
228        </p>
229      </div>
230      <div class="refsect1">
231        <a id="overview"></a>
232        <h2>Overview</h2>
233        <p>
234            The <em class="firstterm">Khronos Native Platform Graphics
235            Interface</em> (EGL) provides a means for rendering
236            using a <em class="firstterm">client API</em> such as OpenGL ES
237            (a 3D renderer for embedded systems), OpenGL (a functional
238            superset of OpenGL ES for desktop systems), and OpenVG (a 2D
239            vector graphics renderer) together with a native window
240            system, such as Microsoft Windows or the X Window System.
241        </p>
242        <p>
243            Depending on its implementation EGL might be more or less
244            tightly integrated into the native window system. Most EGL
245            functions require an EGL display connection, which can be
246            obtained by calling
247            <a class="citerefentry" href="eglGetDisplay.html"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>
248            and passing in a native display handle or
249            <code class="constant">EGL_DEFAULT_DISPLAY</code>. To initialize and
250            query what EGL version is supported on the display
251            connection, call
252            <a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>.
253        </p>
254        <p>
255            Native window systems supporting EGL make a subset of their
256            visuals (which may also referred to as pixel formats, frame
257            buffer configurations, or other similar terms) available for
258            client API rendering. Windows and pixmaps created with these
259            visuals may also be rendered into using the native window
260            system API.
261        </p>
262        <p>
263            An EGL <em class="firstterm">surface</em> extends a native
264            window or pixmap with additional <em class="firstterm">auxillary
265            buffers</em>. These buffers include a color buffer, a
266            depth buffer, a stencil buffer, and an alpha mask buffer.
267            Some or all of the buffers listed are included in each EGL
268            frame buffer configuration.
269        </p>
270        <p>
271            EGL supports rendering into three types of surfaces:
272            windows, pixmaps and pixel buffers (pbuffers). EGL window
273            and pixmap surfaces are associated with corresponding
274            resources of the native window system. EGL pixel buffers are
275            EGL only resources, and do not accept rendering through the
276            native window system.
277        </p>
278        <p>
279            To render using a client API into an EGL surface, you must
280            determine the appropriate EGL frame buffer configuration,
281            which supports the rendering features the application
282            requires.
283            <a class="citerefentry" href="eglChooseConfig.html"><span class="citerefentry"><span class="refentrytitle">eglChooseConfig</span></span></a>
284            returns an <span class="type">EGLConfig</span> matching the required
285            attributes, if any. A complete list of EGL frame buffer
286            configurations can be obtained by calling
287            <a class="citerefentry" href="eglGetConfigs.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>.
288            Attributes of a particular EGL frame buffer configuration
289            can be queried by calling
290            <a class="citerefentry" href="eglGetConfigAttrib.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>.
291        </p>
292        <p>
293            For EGL window and pixmap surfaces, a suitable native window
294            or pixmap with a matching native visual must be created
295            first. For a given EGL frame buffer configuration, the
296            native visual type and ID can be retrieved with a call to
297            <a class="citerefentry" href="eglGetConfigAttrib.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>.
298            For pixel buffers, no underlying native resource is
299            required.
300        </p>
301        <p>
302            To create an EGL window surface from a native window, call
303            <a class="citerefentry" href="eglCreateWindowSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>.
304            To create an EGL pixmap surface from a native pixmap, call
305            <a class="citerefentry" href="eglCreatePixmapSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>.
306            To create a pixel buffer (pbuffer) surface (which has no
307            associated native buffer), call
308            <a class="citerefentry" href="eglCreatePbufferSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>
309            To create a pixel buffer (pbuffer) surface whose color
310            buffer is provided by an OpenVG <span class="type">VGImage</span>, call
311            <a class="citerefentry" href="eglCreatePbufferFromClientBuffer.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferFromClientBuffer</span></span></a>.
312            Use
313            <a class="citerefentry" href="eglDestroySurface.html"><span class="citerefentry"><span class="refentrytitle">eglDestroySurface</span></span></a>
314            to release previously allocated resources.
315        </p>
316        <p>
317            An EGL rendering context is required to bind client API
318            rendering to an EGL surface. An EGL surface and an EGL
319            rendering context must have compatible EGL frame buffer
320            configurations. To create an EGL rendering context, call
321            <a class="citerefentry" href="eglCreateContext.html"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>.
322            The type of client API context created (OpenGL ES, OpenVG,
323            etc.) can be changed by first calling
324            <a class="citerefentry" href="eglBindAPI.html"><span class="citerefentry"><span class="refentrytitle">eglBindAPI</span></span></a>.
325        </p>
326        <p>
327            An EGL rendering context may be bound to one or two EGL
328            surfaces by calling
329            <a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>.
330            This context/surface(s) association specifies the
331            <em class="firstterm">current context</em> and
332            <em class="firstterm">current surface</em>, and is used by all
333            client API rendering commands for the bound context until
334            <a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>
335            is called with different arguments.
336        </p>
337        <p>
338            Both native and client API commands may be used to operate
339            on certain surfaces, however, the two command streams are
340            not synchronized. Synchronization can be explicitly
341            specified using by calling
342            <a class="citerefentry" href="eglWaitCLient.html"><span class="citerefentry"><span class="refentrytitle">eglWaitCLient</span></span></a>,
343            <a class="citerefentry" href="eglWaitNative.html"><span class="citerefentry"><span class="refentrytitle">eglWaitNative</span></span></a>,
344            and possibly by calling other native window system commands.
345        </p>
346      </div>
347      <div class="refsect1">
348        <a id="examples"></a>
349        <h2>Examples</h2>
350        <p>
351            Below is a minimal example of creating an RGBA-format window that
352            allows rendering with OpenGL ES.
353            The window is cleared to yellow when the program runs. For simplicity,
354            the program does not check for any errors.
355        </p>
356        <pre class="programlisting">
357#include &lt;stdlib.h&gt;
358#include &lt;unistd.h&gt;
359#include &lt;EGL/egl.h&gt;
360#include &lt;GLES/gl.h&gt;
361typedef ... NativeWindowType;
362extern NativeWindowType createNativeWindow(void);
363static EGLint const attribute_list[] = {
364        EGL_RED_SIZE, 1,
365        EGL_GREEN_SIZE, 1,
366        EGL_BLUE_SIZE, 1,
367        EGL_NONE
368};
369int main(int argc, char ** argv)
370{
371        EGLDisplay display;
372        EGLConfig config;
373        EGLContext context;
374        EGLSurface surface;
375        NativeWindowType native_window;
376        EGLint num_config;
377
378        /* get an EGL display connection */
379        display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
380
381        /* initialize the EGL display connection */
382        eglInitialize(display, NULL, NULL);
383
384        /* get an appropriate EGL frame buffer configuration */
385        eglChooseConfig(display, attribute_list, &amp;config, 1, &amp;num_config);
386
387        /* create an EGL rendering context */
388        context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
389
390        /* create a native window */
391        native_window = createNativeWindow();
392
393        /* create an EGL window surface */
394        surface = eglCreateWindowSurface(display, config, native_window, NULL);
395
396        /* connect the context to the surface */
397        eglMakeCurrent(display, surface, surface, context);
398
399        /* clear the color buffer */
400        glClearColor(1.0, 1.0, 0.0, 1.0);
401        glClear(GL_COLOR_BUFFER_BIT);
402        glFlush();
403
404        eglSwapBuffers(display, surface);
405
406        sleep(10);
407        return EXIT_SUCCESS;
408}
409</pre>
410      </div>
411      <div class="refsect1">
412        <a id="usingeglextensions"></a>
413        <h2>Using EGL Extensions</h2>
414        <p>
415            All supported EGL extensions will have a corresponding definition in
416            <code class="filename">egl.h</code> and a token in the extensions string returned
417            by
418            <a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>.
419        </p>
420      </div>
421      <div class="refsect1">
422        <a id="futureeglversions"></a>
423        <h2>Future EGL Versions</h2>
424        <p>
425            <a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>
426            and
427            <a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>
428            can be used to determine at run-time what version of EGL is available.
429            To check the EGL version at compile-time, test whether
430            <code class="constant">EGL_VERSION_<em class="replaceable"><code>x</code></em>_<em class="replaceable"><code>y</code></em></code>
431            is defined, where <em class="replaceable"><code>x</code></em> and
432            <em class="replaceable"><code>y</code></em> are the major and minor version
433            numbers.
434        </p>
435      </div>
436      <div class="refsect1">
437        <a id="files"></a>
438        <h2>Files</h2>
439        <div class="variablelist">
440          <dl class="variablelist">
441            <dt>
442              <span class="term">
443                <code class="filename">GLES/egl.h</code>
444              </span>
445            </dt>
446            <dd>
447              <p>
448                    EGL header file
449                </p>
450            </dd>
451          </dl>
452        </div>
453      </div>
454      <div class="refsect1">
455        <a id="seealso"></a>
456        <h2>See Also</h2>
457        <p>
458
459            <a class="citerefentry" href="eglBindAPI.html"><span class="citerefentry"><span class="refentrytitle">eglBindAPI</span></span></a>,
460            <a class="citerefentry" href="eglChooseConfig.html"><span class="citerefentry"><span class="refentrytitle">eglChooseConfig</span></span></a>,
461            <a class="citerefentry" href="eglCreateContext.html"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>,
462            <a class="citerefentry" href="eglCreatePbufferFromClientBuffer.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferFromClientBuffer</span></span></a>,
463            <a class="citerefentry" href="eglCreatePbufferSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>,
464            <a class="citerefentry" href="eglCreatePixmapSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>,
465            <a class="citerefentry" href="eglCreateWindowSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>,
466            <a class="citerefentry" href="eglDestroyContext.html"><span class="citerefentry"><span class="refentrytitle">eglDestroyContext</span></span></a>,
467            <a class="citerefentry" href="eglDestroySurface.html"><span class="citerefentry"><span class="refentrytitle">eglDestroySurface</span></span></a>,
468            <a class="citerefentry" href="eglGetConfigs.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>,
469            <a class="citerefentry" href="eglGetDisplay.html"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>,
470            <a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>,
471            <a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>,
472            <a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>,
473            <a class="citerefentry" href="eglSwapBuffers.html"><span class="citerefentry"><span class="refentrytitle">eglSwapBuffers</span></span></a>,
474            <a class="citerefentry" href="eglTerminate.html"><span class="citerefentry"><span class="refentrytitle">eglTerminate</span></span></a>,
475            <a class="citerefentry" href="eglWaitGL.html"><span class="citerefentry"><span class="refentrytitle">eglWaitGL</span></span></a>,
476            <a class="citerefentry" href="eglWaitNative.html"><span class="citerefentry"><span class="refentrytitle">eglWaitNative</span></span></a>
477        </p>
478      </div>
479      <div xmlns="" class="refsect3" lang="en" xml:lang="en"><a xmlns="http://www.w3.org/1999/xhtml" id="Copyright"></a><h4 xmlns="http://www.w3.org/1999/xhtml"></h4><img xmlns="http://www.w3.org/1999/xhtml" src="KhronosLogo.jpg" /><p xmlns="http://www.w3.org/1999/xhtml"></p>
480Copyright © 2003-2014 The Khronos Group Inc.
481Permission is hereby granted, free of charge, to any person obtaining a
482copy of this software and/or associated documentation files (the
483"Materials"), to deal in the Materials without restriction, including
484without limitation the rights to use, copy, modify, merge, publish,
485distribute, sublicense, and/or sell copies of the Materials, and to
486permit persons to whom the Materials are furnished to do so, subject to
487the condition that this copyright notice and permission notice shall be included
488in all copies or substantial portions of the Materials.
489</div>
490    </div>
491  </body>
492</html>
493