2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
8 This manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0
9 US). To view a copy of this license, visit http://creativecommons.org.license/by-sa/3.0/us.
14 xmlns:xi="http://www.w3.org/2001/XInclude">
16 <!-- See http://www.docbook.org/tdg/en/html/refentry.html. -->
19 <refentrytitle>waffle_init</refentrytitle>
20 <manvolnum>3</manvolnum>
24 <refname>waffle_init</refname>
25 <refpurpose>Initialize waffle's per-process global state</refpurpose>
29 <title>Waffle Manual</title>
30 <productname>waffle</productname>
31 <xi:include href="common/author-lina.versace.xml"/>
32 <xi:include href="common/copyright.xml"/>
33 <xi:include href="common/legalnotice.xml"/>
38 <funcsynopsisinfo><![CDATA[#include <waffle.h>]]></funcsynopsisinfo>
40 <funcdef>bool <function>waffle_init</function></funcdef>
41 <paramdef>const int32_t <parameter>attrib_list</parameter>[]</paramdef>
47 <title>Description</title>
50 <function>waffle_init()</function> initializes the per-process global state of the waffle library with the
51 attributes specified in <parameter>attrib_list</parameter>. The set of attributes is documented below.
52 <parameter>attrib_list</parameter> consists of a zero-terminated sequence of name/value pairs.
56 Most waffle functions emit an error if called when waffle is unitialized. The small set of functions that can be
57 successfully called before initialization are explicitly documented as such.
61 If a call to <function>waffle_init()</function> fails, no global state is initialized and the caller may safely
62 attempt to call <function>waffle_init()</function> again. If waffle has already been initialized by a successful
63 call to <function>waffle_init()</function> one has to call <function>waffle_teardown()</function> to clear the
64 global state. Otherwise calling <function>waffle_init()</function> again emits the error
65 <errorcode>WAFFLE_ERROR_ALREADY_INITIALIZED</errorcode>.
71 <title>Attributes</title>
76 <term><constant>WAFFLE_PLATFORM</constant></term>
79 This attribute is required. Possible values are:
84 <term><constant>WAFFLE_PLATFORM_ANDROID</constant></term>
87 [Android] Use EGL on Android.
93 <term><constant>WAFFLE_PLATFORM_GBM</constant></term>
96 [Linux] Use EGL with GBM, the "Generic Buffer Manager" provided by libgbm. This platform is
97 capable of OpenGL rendering without a display manager.
103 <term><constant>WAFFLE_PLATFORM_CGL</constant></term>
106 [MacOS] Use CGL to create the
107 <citerefentry><refentrytitle><function>waffle_config</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>
109 <citerefentry><refentrytitle><function>waffle_context</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>.
110 Use Cocoa to create the
111 <citerefentry><refentrytitle><function>waffle_window</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>.
117 <term><constant>WAFFLE_PLATFORM_GLX</constant></term>
120 [Linux only, MacOS not yet supported]
125 <term><constant>WAFFLE_PLATFORM_SURFACELESS_EGL</constant></term>
128 [Linux] Use EGL's "surfaceless" platform,
129 <ulink url="https://www.khronos.org/registry/egl/extensions/MESA/EGL_MESA_platform_surfaceless.txt">EGL_MESA_platform_surfaceless</ulink>.
134 <term><constant>WAFFLE_PLATFORM_WAYLAND</constant></term>
137 [Linux] Use EGL with the Wayland display server.
142 <term><constant>WAFFLE_PLATFORM_WGL</constant></term>
145 [Windows] Use WGL on Windows.
150 <term><constant>WAFFLE_PLATFORM_X11_EGL</constant></term>
153 [Linux] Use EGL with the X11 display server.
167 <title>Return Value</title>
168 <xi:include href="common/return-value.xml"/>
172 <title>Errors</title>
174 <xi:include href="common/error-codes.xml"/>
177 Listed are the errors specific to <function>waffle_init()</function>.
183 <term><errorcode>WAFFLE_ERROR_ALREADY_INITIALIZED</errorcode></term>
186 Waffle has already been initialized with a successful call to <function>waffle_init()</function>.
192 <term><errorcode>WAFFLE_ERROR_BAD_ATTRIBUTE</errorcode></term>
195 An item in <parameter>attrib_list</parameter> is unrecognized or has an invalid value, or a required
196 attribute is missing.
202 <term><errorcode>WAFFLE_ERROR_BUILT_WITHOUT_SUPPORT</errorcode></term>
205 Waffle was built without support for the requested attribute.
215 <title>Example</title>
218 Initialize waffle for X11/EGL.
225 static const int32_t init_attrib_list[] = {
226 WAFFLE_PLATFORM, WAFFLE_PLATFORM_X11_EGL,
233 bool ok = waffle_init(init_attrib_list);
243 <xi:include href="common/issues.xml"/>
246 <title>See Also</title>
248 <citerefentry><refentrytitle>waffle</refentrytitle><manvolnum>7</manvolnum></citerefentry>
255 vim:tw=120 et ts=2 sw=2: