---
name: "al_set_current_opengl_context"
section: "3"
platform: "linux"
package: "allegro"
version: "5.2.11.3-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/al_set_current_opengl_context"
---

# al\_set\_current\_opengl\_context(3)

Allegro 5 API

## NAME

al\_set\_current\_opengl\_context - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro_opengl.h>
  void al_set_current_opengl_context(ALLEGRO_DISPLAY *display)
  ```

## DESCRIPTION

Make the OpenGL context associated with the given display current for the calling thread. If there is a current target bitmap which belongs to a different OpenGL context, the target bitmap will be changed to NULL.

Normally you do not need to use this function, as the context will be made current when you call [al\_set\_target\_bitmap(3)](/al_set_target_bitmap/3.md) or [al\_set\_target\_backbuffer(3)](/al_set_target_backbuffer/3.md). You might need it if you created an OpenGL “forward compatible” context. Then [al\_get\_backbuffer(3)](/al_get_backbuffer/3.md) only returns NULL, so it would not work to pass that to [al\_set\_target\_bitmap(3)](/al_set_target_bitmap/3.md).
