---
name: "waffle_context"
section: "3"
platform: "linux"
package: "libwaffle-doc"
version: "1.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/waffle_context"
---

# waffle\_context(3)

class waffle\_context

## NAME

waffle\_context, waffle\_context\_create, waffle\_context\_destroy, waffle\_context\_get\_native - class waffle\_context

## SYNOPSIS

```
#include <waffle.h>
struct waffle_context;
```

**struct waffle\_context\* waffle\_context\_create(struct waffle\_config \****config***, struct waffle\_context \****shared\_ctx***);**

**bool waffle\_context\_destroy(struct waffle\_context \****self***);**

**union waffle\_native\_context\* waffle\_context\_get\_native(struct waffle\_context \****self***);**

## DESCRIPTION

**struct waffle\_context**

An opaque type.

**waffle\_context\_create()**

Create a context for OpenGL rendering with the properties specified by *config*.

The returned context's actual properties may differ from, but are guaranteed to be compatible with, the properties specified by *config*. See the section called “VERSION PROMOTION” below for details.

If *share\_ctx* is not null, then the newly created context is added to the share group of *share\_ctx*. Some data, such as display lists, are shared among all contexts that belong to the same share group. For details on what data is shared, see the specification for the relevant native platform: the **GLX 1.4 Specification**\[1\], the **EGL 1.4 Specification**\[2\], or the **CGL Reference**\[3\].

**waffle\_context\_destroy()**

Destroy the context and release its memory.

**waffle\_context\_get\_native()**

Get the context's underlying native objects. Use [**free**(3)](/free/3.md) to deallocate the returned pointer. See [**waffle\_native**(3)](/waffle_native/3.md) for the definition of **union waffle\_native\_context**.

## VERSION PROMOTION

The context's requested version and profile is given by the config attributes **WAFFLE\_CONTEXT\_MAJOR\_VERSION**, **WAFFLE\_CONTEXT\_MINOR\_VERSION**, **WAFFLE\_CONTEXT\_PROFILE**. The context returned by **waffle\_context\_create** may implement any version and profile that is backwards compatible with that requested, as described below.

• If the chosen API is **WAFFLE\_OPENGL\_ES1**, **WAFFLE\_OPENGL\_ES2**, or **WAFFLE\_OPENGL\_ES3**, then the returned context may implement any of:

\* The requested version.

\* Any later version, so long as no features have been from that later version.

• If the chosen API is **WAFFLE\_CONTEXT\_OPENGL** and version 3.0 or less is requested, then the returned context may implement any of:

\* Any version no less than that requested and no greater than 3.0.

\* Version 3.1, if the GL\_ARB\_compatibility extension is also implemented.

\* The compatibility profile of version 3.2 or greater.

• If the chosen API is **WAFFLE\_CONTEXT\_OPENGL** and version 3.1 is requested, then the returned context may implement any of:

\* Version 3.1, with or without the GL\_ARB\_compatibility extension.

\* The core profile of version 3.2 or greater.

• If the chosen API is **WAFFLE\_CONTEXT\_OPENGL** and version 3.2 or greater is requested, then the returned context may implement any of:

\* The requested profile and version.

\* The requested profile of any later version, so long as no features have been from that later version and profile.

## RETURN VALUE

Functions whose return type is **bool** return true on success and false on failure. Functions whose return type is a pointer return **NULL** on failure. Use [**waffle\_error\_get\_info**(3)](/waffle_error_get_info/3.md) to get information about any errors.

## ERRORS

See [**waffle\_error**(3)](/waffle_error/3.md) for the complete list of waffle's error codes.

No errors are specific to the **waffle\_context** functions.

## ISSUES

Please report bugs or and feature requests to **https://gitlab.freedesktop.org/mesa/waffle/issues**.

## SEE ALSO

[**waffle**(7)](/waffle/7.md) [**waffle\_config\_choose**(3)](/waffle_config_choose/3.md)

## AUTHOR

**Chad Versace** \<chad.versace@linux.intel.com\>

Former maintainer

## COPYRIGHT

Copyright © 2013 Intel\

This manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0). To view a copy of this license, visit **http://creativecommons.org.license/by-sa/3.0/us**.

## NOTES

- 1\.

  GLX 1.4 Specification

  http://www.opengl.org/registry/doc/glx1.4.pdf

- 2\.

  EGL 1.4 Specification

  http://www.khronos.org/registry/egl/specs/eglspec.1.4.20110406.pdf

- 3\.

  CGL Reference

  https://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CGL\_OpenGL/Reference/reference.html
