attempt at fixing THE FLICKERING without making everything shitty. also, clean up code

This commit is contained in:
StapleButter 2019-05-31 02:21:41 +02:00
parent 27d451d07a
commit 3ef00f8fa6
1 changed files with 13 additions and 13 deletions

View File

@ -3,6 +3,8 @@
#include <GL/gl.h> #include <GL/gl.h>
void* glXGetProcAddressARB(const GLubyte* name);
extern GThread* gtkthread; extern GThread* gtkthread;
struct uiGLContext struct uiGLContext
@ -179,7 +181,6 @@ static void areaRellocRenderbuffer(uiGLContext* glctx)
void areaPreRedrawGL(uiGLContext* glctx) void areaPreRedrawGL(uiGLContext* glctx)
{ {
g_mutex_lock(&glctx->mutex); g_mutex_lock(&glctx->mutex);
glctx->backbuffer = glctx->backbuffer ? 0 : 1;
} }
void areaPostRedrawGL(uiGLContext* glctx) void areaPostRedrawGL(uiGLContext* glctx)
@ -206,7 +207,7 @@ void areaDrawGL(GtkWidget* widget, uiAreaDrawParams* dp, cairo_t* cr, uiGLContex
int uiGLGetFramebuffer(uiGLContext* ctx) int uiGLGetFramebuffer(uiGLContext* ctx)
{ {
return ctx->framebuffer[ctx->backbuffer];// ? 0 : 1]; return ctx->framebuffer[ctx->backbuffer];
} }
float uiGLGetFramebufferScale(uiGLContext* ctx) float uiGLGetFramebufferScale(uiGLContext* ctx)
@ -216,8 +217,7 @@ float uiGLGetFramebufferScale(uiGLContext* ctx)
void uiGLSwapBuffers(uiGLContext* ctx) void uiGLSwapBuffers(uiGLContext* ctx)
{ {
// nothing to do here, GTK will take care of this ctx->backbuffer = ctx->backbuffer ? 0 : 1;
//glFinish();
} }
void uiGLMakeContextCurrent(uiGLContext* ctx) void uiGLMakeContextCurrent(uiGLContext* ctx)
@ -250,15 +250,15 @@ void uiGLEnd(uiGLContext* ctx)
void *uiGLGetProcAddress(const char* proc) void *uiGLGetProcAddress(const char* proc)
{ {
printf("get: %s - ", proc); // TODO: consider using epoxy or something funny
void* a = dlsym(NULL, proc);
void* b = glXGetProcAddress(proc); void* ptr = dlsym(NULL /* RTLD_DEFAULT */, proc);
void* c = glXGetProcAddressARB(proc); if (ptr) return ptr;
printf("%p / %p / %p\n", a, b, c);
return a; ptr = glXGetProcAddressARB((const GLubyte*)proc);
// this *will* break for older systems that don't have libglvnd! if (ptr) return ptr;
// TODO: use a real solution
return dlsym(NULL /* RTLD_DEFAULT */, proc); return NULL;
} }
unsigned int uiGLGetVersion(uiGLContext* ctx) unsigned int uiGLGetVersion(uiGLContext* ctx)
{ {