blob: 4ef078ed0db12ec941ba973a3a89f245bf4b8b63 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style xmlns="" type="text/css">
/* This style sets a margin around the entire page */
html, body {
margin: 10px;
}
p {
font: normal 16px verdana, sans-serif;
margin: 0;
padding-bottom:12px;
}
h1 {
font: bold 25px verdana, sans-serif;
margin-top: 0;
margin-bottom: 3px;
padding-top: 0;
padding-bottom: 0;
}
h2 {
font: bold 19px verdana, sans-serif;
margin-top: 28px;
margin-bottom: 3px;
padding-top: 0;
padding-bottom: 0;
}
h3 {
font: bold 19px verdana, sans-serif !important;
margin-top: 28px;
margin-bottom: 3px;
padding-top: 0;
padding-bottom: 0;
}
li {
font: normal 16px verdana, sans-serif;
margin-top: 0;
margin-bottom: 18px;
padding-top: 0;
padding-bottom: 0;
}
.pdparam {
font: italic 16px verdana, sans-serif;
}
.term {
font: italic 16px verdana, sans-serif;
font-weight: normal;
}
.type {
font: normal 16px verdana, sans-serif !important;
}
.parameter {
font-style: italic;
}
a:link, a:visited {
color: blue;
text-decoration: none;
font: normal 16px;
}
a:hover {
background-color: #FFFF99;
font: normal 16px;
}
div.funcsynopsis {
text-align: left;
background-color: #e6e6e6;
font: normal 16px verdana, sans-serif;
padding-top: 10px;
padding-bottom: 10px;
}
div.funcsynopsis table {
border-collapse: separate;
font: normal 16px verdana, sans-serif;
}
div.funcsynopsis td {
background-color: #e6e6e6;
border: 0 solid #000;
padding: 1px;
font: normal 16px verdana, sans-serif;
}
div.refsect1 {
font-family: verdana, sans-serif;
font-size: 16px;
}
code.constant {
font: normal 16px courier new, monospace !important;
}
span.errorname {
font: normal 16px verdana, sans-serif !important;
}
code.function {
font: bold 16px verdana, sans-serif !important;
}
b.fsfunc {
font: bold 16px verdana, sans-serif !important;
}
code.varname {
font: italic 16px verdana, sans-serif;
}
code.replaceable {
font: italic 16px courier new, monospace;
}
code.funcdef {
font: normal 16px verdana, sans-serif !important;
}
.citerefentry {
font: normal 16px verdana, sans-serif !important;
}
.parameter {
font-style: italic;
}
code.fsfunc {
font: normal 16px verdana, sans-serif !important;
}
/* PARAMETER: This style controls spacing between the terms in Parameter section */
dt {
margin-top: 15px;
}
/* TABLES: These styles apply to all tables OTHER than the Synopsis and Example tables */
div.refsect1 table {
width: 100%;
margin-top: 10px;
background-color: #FFF;
border-collapse: collapse;
border-color: #000;
border-width: 1px;
font: normal 16px verdana, sans-serif;
}
div.refsect1 th {
border-collapse: collapse;
border-color: #000;
border-width: 1px;
font: bold 16px verdana, sans-serif;
}
div.refsect1 td {
background-color: #FFF;
padding: 5px;
vertical-align: text-top;
border-collapse: collapse;
border-color: #000;
border-width: 1px;
font: normal 16px verdana, sans-serif;
}
div.refsect1 p{
font: normal 16px verdana, sans-serif;
margin-top: 8px;
margin-bottom: 8px;
padding-top: 0;
padding-bottom: 0;
}
/* EXAMPLE: These styles apply only to the Example section */
div.refsect2 {
font: normal 16px courier new, monospace !important;
}
div.refsect2 table {
margin-top: 0;
background-color: #e6e6e6;
width: 100%;
border: 0 solid #000;
padding: 2px;
font: normal 16px courier new, monospace !important;
}
div.refsect2 td {
background-color: #e6e6e6;
font: normal 16px courier new, monospace !important;
white-space:pre;
}
/* COPYRIGHT: This style formats the text of the copyright statement at the bottom of the page */
div.refsect3 {
font: normal 11px verdana, sans-serif;
margin-top: 50px;
margin-bottom: 20px;
padding-top: 0;
padding-bottom: 0;
}
</style>
<title>eglIntro</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
</head>
<body>
<div class="refentry">
<a id="eglIntro"></a>
<div class="titlepage"></div>
<div xmlns="" class="refnamediv">
<h1>eglIntro</h1>
<p>
introduction to managing client API rendering through the
<acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">EGL</acronym> API.
</p>
</div>
<div class="refsect1">
<a id="overview"></a>
<h2>Overview</h2>
<p>
The <em class="firstterm">Khronos Native Platform Graphics
Interface</em> (EGL) provides a means for rendering
using a <em class="firstterm">client API</em> such as OpenGL ES
(a 3D renderer for embedded systems), OpenGL (a functional
superset of OpenGL ES for desktop systems), and OpenVG (a 2D
vector graphics renderer) together with a native window
system, such as Microsoft Windows or the X Window System.
</p>
<p>
Depending on its implementation EGL might be more or less
tightly integrated into the native window system. Most EGL
functions require an EGL display connection, which can be
obtained by calling
<a class="citerefentry" href="eglGetDisplay.html"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>
and passing in a native display handle or
<code class="constant">EGL_DEFAULT_DISPLAY</code>. To initialize and
query what EGL version is supported on the display
connection, call
<a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>.
</p>
<p>
Native window systems supporting EGL make a subset of their
visuals (which may also referred to as pixel formats, frame
buffer configurations, or other similar terms) available for
client API rendering. Windows and pixmaps created with these
visuals may also be rendered into using the native window
system API.
</p>
<p>
An EGL <em class="firstterm">surface</em> extends a native
window or pixmap with additional <em class="firstterm">auxillary
buffers</em>. These buffers include a color buffer, a
depth buffer, a stencil buffer, and an alpha mask buffer.
Some or all of the buffers listed are included in each EGL
frame buffer configuration.
</p>
<p>
EGL supports rendering into three types of surfaces:
windows, pixmaps and pixel buffers (pbuffers). EGL window
and pixmap surfaces are associated with corresponding
resources of the native window system. EGL pixel buffers are
EGL only resources, and do not accept rendering through the
native window system.
</p>
<p>
To render using a client API into an EGL surface, you must
determine the appropriate EGL frame buffer configuration,
which supports the rendering features the application
requires.
<a class="citerefentry" href="eglChooseConfig.html"><span class="citerefentry"><span class="refentrytitle">eglChooseConfig</span></span></a>
returns an <span class="type">EGLConfig</span> matching the required
attributes, if any. A complete list of EGL frame buffer
configurations can be obtained by calling
<a class="citerefentry" href="eglGetConfigs.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>.
Attributes of a particular EGL frame buffer configuration
can be queried by calling
<a class="citerefentry" href="eglGetConfigAttrib.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>.
</p>
<p>
For EGL window and pixmap surfaces, a suitable native window
or pixmap with a matching native visual must be created
first. For a given EGL frame buffer configuration, the
native visual type and ID can be retrieved with a call to
<a class="citerefentry" href="eglGetConfigAttrib.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigAttrib</span></span></a>.
For pixel buffers, no underlying native resource is
required.
</p>
<p>
To create an EGL window surface from a native window, call
<a class="citerefentry" href="eglCreateWindowSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>.
To create an EGL pixmap surface from a native pixmap, call
<a class="citerefentry" href="eglCreatePixmapSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>.
To create a pixel buffer (pbuffer) surface (which has no
associated native buffer), call
<a class="citerefentry" href="eglCreatePbufferSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>
To create a pixel buffer (pbuffer) surface whose color
buffer is provided by an OpenVG <span class="type">VGImage</span>, call
<a class="citerefentry" href="eglCreatePbufferFromClientBuffer.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferFromClientBuffer</span></span></a>.
Use
<a class="citerefentry" href="eglDestroySurface.html"><span class="citerefentry"><span class="refentrytitle">eglDestroySurface</span></span></a>
to release previously allocated resources.
</p>
<p>
An EGL rendering context is required to bind client API
rendering to an EGL surface. An EGL surface and an EGL
rendering context must have compatible EGL frame buffer
configurations. To create an EGL rendering context, call
<a class="citerefentry" href="eglCreateContext.html"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>.
The type of client API context created (OpenGL ES, OpenVG,
etc.) can be changed by first calling
<a class="citerefentry" href="eglBindAPI.html"><span class="citerefentry"><span class="refentrytitle">eglBindAPI</span></span></a>.
</p>
<p>
An EGL rendering context may be bound to one or two EGL
surfaces by calling
<a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>.
This context/surface(s) association specifies the
<em class="firstterm">current context</em> and
<em class="firstterm">current surface</em>, and is used by all
client API rendering commands for the bound context until
<a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>
is called with different arguments.
</p>
<p>
Both native and client API commands may be used to operate
on certain surfaces, however, the two command streams are
not synchronized. Synchronization can be explicitly
specified using by calling
<a class="citerefentry" href="eglWaitCLient.html"><span class="citerefentry"><span class="refentrytitle">eglWaitCLient</span></span></a>,
<a class="citerefentry" href="eglWaitNative.html"><span class="citerefentry"><span class="refentrytitle">eglWaitNative</span></span></a>,
and possibly by calling other native window system commands.
</p>
</div>
<div class="refsect1">
<a id="examples"></a>
<h2>Examples</h2>
<p>
Below is a minimal example of creating an RGBA-format window that
allows rendering with OpenGL ES.
The window is cleared to yellow when the program runs. For simplicity,
the program does not check for any errors.
</p>
<pre class="programlisting">
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;EGL/egl.h&gt;
#include &lt;GLES/gl.h&gt;
typedef ... NativeWindowType;
extern NativeWindowType createNativeWindow(void);
static EGLint const attribute_list[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int main(int argc, char ** argv)
{
EGLDisplay display;
EGLConfig config;
EGLContext context;
EGLSurface surface;
NativeWindowType native_window;
EGLint num_config;
/* get an EGL display connection */
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
/* initialize the EGL display connection */
eglInitialize(display, NULL, NULL);
/* get an appropriate EGL frame buffer configuration */
eglChooseConfig(display, attribute_list, &amp;config, 1, &amp;num_config);
/* create an EGL rendering context */
context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
/* create a native window */
native_window = createNativeWindow();
/* create an EGL window surface */
surface = eglCreateWindowSurface(display, config, native_window, NULL);
/* connect the context to the surface */
eglMakeCurrent(display, surface, surface, context);
/* clear the color buffer */
glClearColor(1.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
eglSwapBuffers(display, surface);
sleep(10);
return EXIT_SUCCESS;
}
</pre>
</div>
<div class="refsect1">
<a id="usingeglextensions"></a>
<h2>Using EGL Extensions</h2>
<p>
All supported EGL extensions will have a corresponding definition in
<code class="filename">egl.h</code> and a token in the extensions string returned
by
<a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>.
</p>
</div>
<div class="refsect1">
<a id="futureeglversions"></a>
<h2>Future EGL Versions</h2>
<p>
<a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>
and
<a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>
can be used to determine at run-time what version of EGL is available.
To check the EGL version at compile-time, test whether
<code class="constant">EGL_VERSION_<em class="replaceable"><code>x</code></em>_<em class="replaceable"><code>y</code></em></code>
is defined, where <em class="replaceable"><code>x</code></em> and
<em class="replaceable"><code>y</code></em> are the major and minor version
numbers.
</p>
</div>
<div class="refsect1">
<a id="files"></a>
<h2>Files</h2>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="filename">GLES/egl.h</code>
</span>
</dt>
<dd>
<p>
EGL header file
</p>
</dd>
</dl>
</div>
</div>
<div class="refsect1">
<a id="seealso"></a>
<h2>See Also</h2>
<p>
<a class="citerefentry" href="eglBindAPI.html"><span class="citerefentry"><span class="refentrytitle">eglBindAPI</span></span></a>,
<a class="citerefentry" href="eglChooseConfig.html"><span class="citerefentry"><span class="refentrytitle">eglChooseConfig</span></span></a>,
<a class="citerefentry" href="eglCreateContext.html"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>,
<a class="citerefentry" href="eglCreatePbufferFromClientBuffer.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferFromClientBuffer</span></span></a>,
<a class="citerefentry" href="eglCreatePbufferSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>,
<a class="citerefentry" href="eglCreatePixmapSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>,
<a class="citerefentry" href="eglCreateWindowSurface.html"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>,
<a class="citerefentry" href="eglDestroyContext.html"><span class="citerefentry"><span class="refentrytitle">eglDestroyContext</span></span></a>,
<a class="citerefentry" href="eglDestroySurface.html"><span class="citerefentry"><span class="refentrytitle">eglDestroySurface</span></span></a>,
<a class="citerefentry" href="eglGetConfigs.html"><span class="citerefentry"><span class="refentrytitle">eglGetConfigs</span></span></a>,
<a class="citerefentry" href="eglGetDisplay.html"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>,
<a class="citerefentry" href="eglInitialize.html"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>,
<a class="citerefentry" href="eglMakeCurrent.html"><span class="citerefentry"><span class="refentrytitle">eglMakeCurrent</span></span></a>,
<a class="citerefentry" href="eglQueryString.html"><span class="citerefentry"><span class="refentrytitle">eglQueryString</span></span></a>,
<a class="citerefentry" href="eglSwapBuffers.html"><span class="citerefentry"><span class="refentrytitle">eglSwapBuffers</span></span></a>,
<a class="citerefentry" href="eglTerminate.html"><span class="citerefentry"><span class="refentrytitle">eglTerminate</span></span></a>,
<a class="citerefentry" href="eglWaitGL.html"><span class="citerefentry"><span class="refentrytitle">eglWaitGL</span></span></a>,
<a class="citerefentry" href="eglWaitNative.html"><span class="citerefentry"><span class="refentrytitle">eglWaitNative</span></span></a>
</p>
</div>
<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>
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.
</div>
</div>
</body>
</html>