diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-31 03:41:36 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-31 03:41:36 (GMT) |
commit | c56ec08ba99984d5c5c86ab183ee4d6195c805a5 (patch) | |
tree | 496a1d50db3d5b54a63c873212fe2f08d94f1013 /src/OffscreenContextGLX.cc | |
parent | a6ea63099bbbd6966b48c11cf5a69bcb31fbf965 (diff) |
better removal of GCC -Waddress GL macro warning - using pragma
Diffstat (limited to 'src/OffscreenContextGLX.cc')
-rw-r--r-- | src/OffscreenContextGLX.cc | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/src/OffscreenContextGLX.cc b/src/OffscreenContextGLX.cc index 52cf49d..8ec473f 100644 --- a/src/OffscreenContextGLX.cc +++ b/src/OffscreenContextGLX.cc @@ -226,38 +226,7 @@ bool create_glx_dummy_window(OffscreenContext &ctx) return true; } - -Bool create_glx_dummy_context(OffscreenContext &ctx) -{ - // This will alter ctx.openGLContext and ctx.xdisplay and ctx.xwindow if successfull - int major; - int minor; - Bool result = False; - - ctx.xdisplay = XOpenDisplay( NULL ); - if ( ctx.xdisplay == NULL ) { - cerr << "Unable to open a connection to the X server\n"; - return False; - } - - // glxQueryVersion is not always reliable. Use it, but then - // also check to see if GLX 1.3 functions exist - - glXQueryVersion(ctx.xdisplay, &major, &minor); -#ifdef glXGetVisualFromFBConfig - if ( major==1 && minor<=2 && glXGetVisualFromFBConfig==NULL ) { -#else - if ( major==1 && minor<=2 ) { -#endif - cerr << "Error: GLX version 1.3 functions missing. " - << "Your GLX version: " << major << "." << minor << endl; - } else { - result = create_glx_dummy_window(ctx); - } - - if (!result) XCloseDisplay( ctx.xdisplay ); - return result; -} +Bool create_glx_dummy_context(OffscreenContext &ctx); OffscreenContext *create_offscreen_context(int w, int h) { @@ -293,3 +262,32 @@ bool save_framebuffer(OffscreenContext *ctx, std::ostream &output) return save_framebuffer_common(ctx, output); } +#pragma GCC diagnostic ignored "-Waddress" +Bool create_glx_dummy_context(OffscreenContext &ctx) +{ + // This will alter ctx.openGLContext and ctx.xdisplay and ctx.xwindow if successfull + int major; + int minor; + Bool result = False; + + ctx.xdisplay = XOpenDisplay( NULL ); + if ( ctx.xdisplay == NULL ) { + cerr << "Unable to open a connection to the X server\n"; + return False; + } + + // glxQueryVersion is not always reliable. Use it, but then + // also check to see if GLX 1.3 functions exist + + glXQueryVersion(ctx.xdisplay, &major, &minor); + if ( major==1 && minor<=2 && glXGetVisualFromFBConfig==NULL ) { + cerr << "Error: GLX version 1.3 functions missing. " + << "Your GLX version: " << major << "." << minor << endl; + } else { + result = create_glx_dummy_window(ctx); + } + + if (!result) XCloseDisplay( ctx.xdisplay ); + return result; +} + |