1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:base="" xml:id="eglCreatePlatformWindowSurface">
<info>
<copyright>
<year>2003-2018</year>
<holder>The Khronos Group Inc.</holder>
</copyright>
</info>
<refmeta>
<refentrytitle>eglCreatePlatformWindowSurface</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>eglCreatePlatformWindowSurface</refname>
<refpurpose>
create a new <acronym>EGL</acronym> on-screen rendering surface
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>EGLSurface <function>eglCreatePlatformWindowSurface</function></funcdef>
<paramdef>EGLDisplay <parameter>display</parameter></paramdef>
<paramdef>EGLConfig <parameter>config</parameter></paramdef>
<paramdef>void * <parameter>native_window</parameter></paramdef>
<paramdef>EGLAttrib const * <parameter>attrib_list</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 xml:id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>display</parameter></term>
<listitem><para>Specifies the EGL display connection.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>config</parameter></term>
<listitem>
<para>Specifies the EGL frame buffer configuration that defines the
frame buffer resource available to the surface.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>native_window</parameter></term>
<listitem><para>Specifies the native window.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>attrib_list</parameter></term>
<listitem><para>
Specifies a list of attributes for the window surface.
May be <constant>NULL</constant> or empty
(first attribute is <constant>EGL_NONE</constant>).
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 xml:id="description"><title>Description</title>
<para>
<function>eglCreatePlatformWindowSurface</function> creates an
on-screen EGL window surface and returns a handle to it. Any EGL
context created with a compatible <type>EGLConfig</type> can be
used to render into this surface.
</para>
<para>
If <function>eglCreatePlatformWindowSurface</function> fails to
create a window surface, <constant>EGL_NO_SURFACE</constant> is
returned.
</para>
<para>
<parameter>native_window</parameter> must belong to the same
platform as <parameter>display</parameter>, and EGL considers
the returned <type>EGLSurface</type> as belonging to that same
platform. The EGL extension that defines the platform to which
<parameter>display</parameter> belongs also defines the
requirements for the <parameter>native_window</parameter>
parameter.
</para>
<para>
Surface attributes are specified as a list of
attribute-value pairs, terminated with
<constant>EGL_NONE</constant>. Accepted attributes
are:
</para>
<variablelist>
<varlistentry>
<term><constant>EGL_GL_COLORSPACE</constant></term>
<listitem>
<para>
Specifies the color space used by OpenGL and OpenGL ES
when rendering to the surface. If its value is
<constant>EGL_GL_COLORSPACE_SRGB</constant>, then a
non-linear, perceptually uniform color space is assumed,
with a corresponding
<constant>GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</constant>
value of <constant>GL_SRGB</constant>. If its value is
<constant>EGL_GL_COLORSPACE_LINEAR</constant>, then a
linear color space is assumed, with a corresponding
<constant>GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</constant>
value of <constant>GL_LINEAR</constant>. The default
value of <constant>EGL_GL_COLORSPACE</constant> is
<constant>EGL_GL_COLORSPACE_LINEAR</constant>.
</para>
<para>
Note that the <constant>EGL_GL_COLORSPACE</constant>
attribute is used only by OpenGL and OpenGL ES contexts
supporting sRGB framebuffers. EGL itself does not
distinguish multiple colorspace models. Refer to the
``sRGB Conversion'' sections of the OpenGL 4.6 and
OpenGL ES 3.2 Specifications for more information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>EGL_RENDER_BUFFER</constant></term>
<listitem>
<para>
Specifies which buffer should be used for client API
rendering to the window. If its value is
<constant>EGL_SINGLE_BUFFER</constant>, then client
APIs should render directly into the visible window.
If its value is
<constant>EGL_BACK_BUFFER</constant>, then client
APIs should render into the back buffer. The default
value of <constant>EGL_RENDER_BUFFER</constant> is
<constant>EGL_BACK_BUFFER</constant>.
</para>
<para>
Client APIs may not be able to respect the requested
rendering buffer. To determine the actual buffer
being rendered to by a context, call
<citerefentry><refentrytitle>eglQueryContext</refentrytitle></citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>EGL_VG_ALPHA_FORMAT</constant></term>
<listitem>
<para>
Specifies how alpha values are interpreted by OpenVG
when rendering to the surface. If its value is
<constant>EGL_VG_ALPHA_FORMAT_NONPRE</constant>,
then alpha values are not premultipled. If its value
is <constant>EGL_VG_ALPHA_FORMAT_PRE</constant>,
then alpha values are premultiplied. The default
value of <constant>EGL_VG_ALPHA_FORMAT</constant> is
<constant>EGL_VG_ALPHA_FORMAT_NONPRE</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>EGL_VG_COLORSPACE</constant></term>
<listitem>
<para>
Specifies the color space used by OpenVG when
rendering to the surface. If its value is
<constant>EGL_VG_COLORSPACE_sRGB</constant>, then a
non-linear, perceptually uniform color space is
assumed, with a corresponding
<type>VGImageFormat</type> of form
<constant>VG_s*</constant>. If its value is
<constant>EGL_VG_COLORSPACE_LINEAR</constant>, then
a linear color space is assumed, with a
corresponding <type>VGImageFormat</type> of form
<constant>VG_l*</constant>. The default value of
<constant>EGL_VG_COLORSPACE</constant> is
<constant>EGL_VG_COLORSPACE_sRGB</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Any EGL rendering context that was created with respect to
<parameter>config</parameter> can be used to render into the
surface. Use
<citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>
to attach an EGL rendering context to the surface.
</para>
<para>
Use
<citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
to retrieve the ID of <parameter>config</parameter>.
</para>
<para>
Use
<citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>
to destroy the surface.
</para>
</refsect1>
<refsect1 xml:id="notes"><title>Notes</title>
<para>
Attribute <constant>EGL_GL_COLORSPACE</constant> is supported
only if the EGL version is 1.5 or greater.
</para>
<para>
Attributes <constant>EGL_RENDER_BUFFER</constant>,
<constant>EGL_VG_ALPHA_FORMAT</constant>, and
<constant>EGL_VG_COLORSPACE</constant>, and the
corresponding attribute values, are supported only if the
EGL version is 1.2 or greater.
</para>
<!-- Might want to mention aliasing of EGL_VG_* -> EGL_* that occurred in EGL 1.3 -->
<para>
The <constant>EGL_VG_ALPHA_FORMAT</constant> and
<constant>EGL_VG_COLORSPACE</constant> attributes are used only
by OpenVG and EGL itself. Refer to section 11.2 of the OpenVG
1.0 specification for more information. The platform's use and
interpretation of alpha values is outside the scope of EGL.
However, the preferred behavior is for platforms to ignore the
value of <constant>EGL_VG_ALPHA_FORMAT</constant> when
compositing window surfaces.
</para>
</refsect1>
<refsect1 xml:id="errors"><title>Errors</title>
<para>
If <parameter>display</parameter> and
<parameter>native_window</parameter> do not belong to the same
platform, then undefined behavior occurs.
</para>
<para>
<constant>EGL_NO_SURFACE</constant> is returned if creation of
the surface fails.
</para>
<para>
<constant>EGL_BAD_DISPLAY</constant> is generated if
<parameter>display</parameter> is not an EGL display connection.
</para>
<para>
<constant>EGL_NOT_INITIALIZED</constant> is generated if
<parameter>display</parameter> has not been initialized.
</para>
<para>
<constant>EGL_BAD_CONFIG</constant> is generated if
<parameter>config</parameter> is not a valid EGL frame buffer
configuration.
</para>
<para>
<constant>EGL_BAD_NATIVE_WINDOW</constant> may be generated if
<parameter>native_window</parameter> is not a valid native
window for the same platform as <parameter>display</parameter>.
</para>
<para>
<constant>EGL_BAD_ATTRIBUTE</constant> is generated if
<parameter>attrib_list</parameter> contains an invalid window attribute
or if an attribute value is not recognized or is out of range.
</para>
<para>
<constant>EGL_BAD_ALLOC</constant> is generated if there is
already an <type>EGLSurface</type> associated with
<parameter>native_window</parameter> (as a result of a previous
<function>eglCreatePlatformWindowSurface</function> call).
</para>
<para>
<constant>EGL_BAD_ALLOC</constant> is generated if the
implementation cannot allocate resources for the new EGL window.
</para>
<para>
<constant>EGL_BAD_MATCH</constant> is generated if the pixel
format of <parameter>native_window</parameter> does not
correspond to the format, type, and size of the color buffers
required by <parameter>config</parameter>.
<constant>EGL_BAD_MATCH</constant> is generated if the pixel
</para>
<para>
<constant>EGL_BAD_MATCH</constant> is generated if
<parameter>config</parameter> does not support rendering to
windows (the <constant>EGL_SURFACE_TYPE</constant> attribute
does not contain <constant>EGL_WINDOW_BIT</constant>).
</para>
<para>
<constant>EGL_BAD_MATCH</constant> is generated if
<parameter>config</parameter> does not support the specified
OpenVG alpha format attribute (the value of
<constant>EGL_VG_ALPHA_FORMAT</constant> is
<constant>EGL_VG_ALPHA_FORMAT_PRE</constant> and the
<constant>EGL_VG_ALPHA_FORMAT_PRE_BIT</constant> is not set
in the <constant>EGL_SURFACE_TYPE</constant> attribute of
<parameter>config</parameter>) or colorspace attribute (the
value of <constant>EGL_VG_COLORSPACE</constant> is
<constant>EGL_VG_COLORSPACE_LINEAR</constant> and the
<constant>EGL_VG_COLORSPACE_LINEAR_IT</constant> is not set
in the <constant>EGL_SURFACE_TYPE</constant> attribute of
<parameter>config</parameter>).
</para>
</refsect1>
<refsect1 xml:id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>eglCreateWindowSurface</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>eglChooseConfig</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>eglGetConfigs</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
</para>
</refsect1>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyright.xml"/>
</refentry>
|