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

# waffle\_make\_current(3)

set and get resources current to the thread

## NAME

waffle\_make\_current, waffle\_get\_current\_display, waffle\_get\_current\_window, waffle\_get\_current\_context - set and get resources current to the thread

## SYNOPSIS

```
#include <waffle.h>
```

**bool waffle\_make\_current(struct waffle\_display \****display***, struct waffle\_window \****window***, struct waffle\_context \****context***);**

**struct waffle\_display \*waffle\_get\_current\_display(void);**

**struct waffle\_window \*waffle\_get\_current\_window(void);**

**struct waffle\_context \*waffle\_get\_current\_context(void);**

## DESCRIPTION

**waffle\_make\_current()**

Bind the given *window* and *context* for rendering on the current thread. *window* and *context* must both have been created on the given *display*. To unbind the current context without binding a new one, set *window* and *context* to **NULL**.

This function is analogous to **glXMakeCurrent**(3), **eglMakeCurrent**(3), and **\[NSOpenGLContext makeCurrentContext\]**.

**waffle\_get\_current\_display()**

Get the display bound to the current thread, as previously bound by **waffle\_make\_current()**. If no display is bound, then return NULL.

This function is analogous to **glXGetCurrentDisplay**(3) and **eglGetCurrentDisplay**(3).

**waffle\_get\_current\_window()**

Get the window bound to the current thread, as previously bound by **waffle\_make\_current()**. If no window is bound, then return NULL.

This function is analogous to **glXGetCurrentDrawable**(3) and **eglGetCurrentSurface**(3).

**waffle\_get\_current\_context()**

Get the context bound to the current thread, as previously bound by **waffle\_make\_current()**. If no context is bound, then return NULL.

This function is analogous to **glXGetCurrentContext**(3) and **eglGetCurrentContext**(3).

## 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 any functions listed in this manual page.

## BUGS

Mixing calls to **waffle\_make\_current()** and the native platform's **MakeCurrent()** on the same thread do not interact well. After calling the native platform's **MakeCurrent()**, future Waffle function calls on the same thread are likely to behave incorrectly.

## ISSUES

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

## SEE ALSO

[**waffle**(7)](/waffle/7.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**.
