summaryrefslogtreecommitdiff
path: root/src/egl_common.h
blob: 5ef78129f48756d51e1279b8bfe7cc2adf6e6e7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include "gl_common.h"

#ifdef STELA_USE_GLAD
#include <glad/egl.h>
#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif

struct stl_egl_global {
    EGLDisplay display;
};

struct stl_egl {
    EGLDisplay display;
    EGLSurface surface;
    EGLContext context;
    EGLContext current;
};

bool stl_maybe_load_egl(void);
bool stl_load_egl(struct stl_egl_global *global);
void stl_terminate_egl(struct stl_egl_global *global);

bool stl_init_egl_context(struct stl_egl *egl, struct stl_egl_global *global, EGLint visual_id, EGLConfig *config);
bool stl_egl_make_current(struct stl_egl *egl);
void stl_egl_release_current(struct stl_egl *egl);
void stl_egl_swap_interval(struct stl_egl *egl, EGLint interval);
void stl_egl_swap_buffers(struct stl_egl *egl);
bool stl_egl_is_ready(struct stl_egl *egl);
void stl_egl_destroy_surface(struct stl_egl *egl);
void stl_egl_destroy_context(struct stl_egl *egl);

void stl_egl_check_error();