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-chad.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_NACL</constant></term>
128 [Linux only, other systems not yet supported]
133 <term><constant>WAFFLE_PLATFORM_WAYLAND</constant></term>
136 [Linux] Use EGL with the Wayland display server.
141 <term><constant>WAFFLE_PLATFORM_WGL</constant></term>
144 [Windows] Use WGL on Windows.
149 <term><constant>WAFFLE_PLATFORM_X11_EGL</constant></term>
152 [Linux] Use EGL with the X11 display server.
166 <title>Return Value</title>
167 <xi:include href="common/return-value.xml"/>
171 <title>Errors</title>
173 <xi:include href="common/error-codes.xml"/>
176 Listed are the errors specific to <function>waffle_init()</function>.
182 <term><errorcode>WAFFLE_ERROR_ALREADY_INITIALIZED</errorcode></term>
185 Waffle has already been initialized with a successfull call to <function>waffle_init()</function>.
191 <term><errorcode>WAFFLE_ERROR_BAD_ATTRIBUTE</errorcode></term>
194 An item in <parameter>attrib_list</parameter> is unrecognized or has an invalid value, or a required
195 attribute is missing.
201 <term><errorcode>WAFFLE_ERROR_BUILT_WITHOUT_SUPPORT</errorcode></term>
204 Waffle was built without support for the requested attribute.
214 <title>Example</title>
217 Initialize waffle for X11/EGL.
224 static const int32_t init_attrib_list[] = {
225 WAFFLE_PLATFORM, WAFFLE_PLATFORM_X11_EGL,
232 bool ok = waffle_init(init_attrib_list);
242 <xi:include href="common/issues.xml"/>
245 <title>See Also</title>
247 <citerefentry><refentrytitle>waffle</refentrytitle><manvolnum>7</manvolnum></citerefentry>
254 vim:tw=120 et ts=2 sw=2: