mirror of https://github.com/vitalif/openscad
better removal of GCC -Waddress GL macro warning - using pragma
parent
a6ea63099b
commit
c56ec08ba9
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue