diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2007-10-25 03:02:09 +0400 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2007-10-25 03:02:09 +0400 |
commit | dc05737206a20d8053949315b0f4b32579c54325 (patch) | |
tree | c7f20e4e4819cc36b591c53bad487201407545b0 /overlay_gl | |
parent | 5fd89af2991923fed6b1a5345bd52f15a57b5ebd (diff) |
Fix Linux overlay for older GLX
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@816 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'overlay_gl')
-rw-r--r-- | overlay_gl/overlay.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c index 34d9ae680..3e53b8c9c 100644 --- a/overlay_gl/overlay.c +++ b/overlay_gl/overlay.c @@ -111,10 +111,8 @@ static void resolveSM() { __attribute__((format(printf, 1, 2))) void ods(const char *format, ...) { if (!bDebug) { - if (sm) { - if (!sm->bDebug) - return; - } + if (! sm || !sm->bDebug) + return; } va_list args; @@ -324,10 +322,21 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) { if (!c) { ods("Current context is: %p", ctx); + c = (Context *) malloc(sizeof(Context)); + if (!c) { + ods("malloc failure"); + return; + } + c->next = contexts; + c->glctx = NULL; + c->dpy = dpy; + c->draw = draw; + + contexts = c; + int attrib[4] = { GLX_FBCONFIG_ID, -1, 0, 0 }; glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &attrib[1]); - int screen = -1; glXQueryContext(dpy, ctx, GLX_SCREEN, &screen); @@ -336,31 +345,23 @@ void glXSwapBuffers(Display * dpy, GLXDrawable draw) { int nelem = -1; GLXFBConfig *fb = glXChooseFBConfig(dpy, screen, attrib, &nelem); ods("ChooseFB returned %d elems: %p\n", nelem, fb); - - GLXContext myctx = glXCreateNewContext(dpy, *fb, GLX_RGBA_TYPE, NULL, 1); - ods("Got Context %p\n", myctx); - - if ((nelem == 1) && (myctx)) { - c = (Context *) malloc(sizeof(Context)); - if (!c) { - ods("malloc failure"); - return; + + GLXContext myctx = NULL; + + if (fb) { + GLXContext myctx = glXCreateNewContext(dpy, *fb, GLX_RGBA_TYPE, NULL, 1); + ods("Got Context %p\n", myctx); + if ((nelem == 1) && (myctx)) { + c->glctx = myctx; + + glXMakeCurrent(dpy, draw, myctx); + + newContext(c); } - c->next = contexts; - - c->glctx = myctx; - c->dpy = dpy; - c->draw = draw; - - contexts = c; - - glXMakeCurrent(dpy, draw, myctx); - - newContext(c); } } - if (c) { + if (c && c->glctx) { glXMakeCurrent(dpy, draw, c->glctx); drawContext(c, dpy, draw); glXMakeCurrent(dpy, draw, ctx); @@ -408,7 +409,7 @@ void initializeLibrary() { else bDebug = false; - ods("Library is HOT\n"); + ods("Mumble overlay library loaded\n"); void *dl = dlopen("libdl.so.2", RTLD_LAZY); if (!dl) { ods("Failed to open libdl.so.2\n"); |