blob: da414376f00a5ec2044e836319120d3881278f54 (
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
37
38
39
40
41
42
43
44
45
46
47
|
// 26 may 2019
#include "uipriv_unix.h"
/*
*(melonDS:17013): Gtk-CRITICAL **: 00:28:09.095: gtk_gl_area_set_required_version: assertion 'GTK_IS_GL_AREA (area)' failed
(melonDS:17013): GLib-GObject-WARNING **: 00:28:09.096: invalid cast from 'GtkGLArea' to 'areaWidget'
*/
struct uiGLContext {
GtkGLArea *gla;
GdkGLContext *gctx;
int vermaj, vermin;
};
uiGLContext *createGLContext(GtkGLArea* gla, int maj, int min)
{
uiGLContext *ret = uiAlloc(sizeof(uiGLContext), "uiGLContext");
ret->gla = gla;
ret->gctx = gtk_gl_area_get_context(gla);
ret->vermaj = maj; ret->vermin = min;
return ret;
}
void uiGLSwapBuffers(uiGLContext* ctx)
{
if (!ctx) return;
gtk_gl_area_attach_buffers(ctx->gla);
}
void uiGLMakeContextCurrent(uiGLContext* ctx)
{
if (!ctx) return;
gtk_gl_area_make_current(ctx->gla);
}
void *uiGLGetProcAddress(const char* proc)
{
// this *will* break for older systems that don't have libglvnd!
// TODO: use a real solution
return dlsym(NULL /* RTLD_DEFAULT */, proc);
}
unsigned int uiGLGetVersion(uiGLContext* ctx)
{
if (!ctx) return 0;
return uiGLVersion(ctx->vermaj, ctx->vermin);
}
|