mirror of https://github.com/vitalif/openscad
clarify error messages.
parent
2325f621d8
commit
adf7cd51fb
|
@ -108,7 +108,7 @@ bool create_glx_dummy_window(OffscreenContext &ctx)
|
|||
XSetErrorHandler( original_xlib_handler );
|
||||
|
||||
// Most programs would call XMapWindow here. But we don't, to keep the window hidden
|
||||
XMapWindow( dpy, xWin );
|
||||
// XMapWindow( dpy, xWin );
|
||||
|
||||
GLXContext context = glXCreateNewContext( dpy, fbconfigs[0], GLX_RGBA_TYPE, NULL, True );
|
||||
if ( context == NULL ) {
|
||||
|
@ -119,10 +119,10 @@ bool create_glx_dummy_window(OffscreenContext &ctx)
|
|||
return false;
|
||||
}
|
||||
|
||||
GLXWindow glxWin = glXCreateWindow( dpy, fbconfigs[0], xWin, NULL );
|
||||
//GLXWindow glxWin = glXCreateWindow( dpy, fbconfigs[0], xWin, NULL );
|
||||
|
||||
//if (!glXMakeContextCurrent( dpy, xWin, xWin, context )) {
|
||||
if (!glXMakeContextCurrent( dpy, glxWin, glxWin, context )) {
|
||||
if (!glXMakeContextCurrent( dpy, xWin, xWin, context )) {
|
||||
//if (!glXMakeContextCurrent( dpy, glxWin, glxWin, context )) {
|
||||
cerr << "glXMakeContextCurrent failed\n";
|
||||
glXDestroyContext( dpy, context );
|
||||
XDestroyWindow( dpy, xWin );
|
||||
|
@ -188,11 +188,11 @@ OffscreenContext *create_offscreen_context(int w, int h)
|
|||
cerr << "Unable to init GLEW: " << glewGetErrorString(err) << endl;
|
||||
return NULL;
|
||||
}
|
||||
glew_dump();
|
||||
|
||||
ctx->fbo = fbo_new();
|
||||
if (!fbo_init(ctx->fbo, w, h)) {
|
||||
cerr << "Framebuffer init failed; dumping GLEW info" << endl;
|
||||
glew_dump();
|
||||
cerr << "GL Framebuffer Object init failed; dumping GLEW info" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,20 +81,20 @@ bool fbo_ext_init(fbo_t *fbo, size_t width, size_t height)
|
|||
// Attach render and depth buffers
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, fbo->renderbuf_id);
|
||||
if (report_glerror("specifying color render buffer")) return false;
|
||||
if (report_glerror("specifying color render buffer EXT")) return false;
|
||||
|
||||
|
||||
if (!check_fbo_status()) {
|
||||
cerr << "Problem with OpenGL framebuffer after specifying color render buffer.\n";
|
||||
cerr << "Problem with OpenGL EXT framebuffer after specifying color render buffer.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, fbo->depthbuf_id);
|
||||
if (report_glerror("specifying depth render buffer")) return false;
|
||||
if (report_glerror("specifying depth render buffer EXT")) return false;
|
||||
|
||||
if (!check_fbo_status()) {
|
||||
cerr << "Problem with OpenGL framebuffer after specifying depth render buffer.\n";
|
||||
cerr << "Problem with OpenGL EXT framebuffer after specifying depth render buffer.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,16 +14,16 @@ void glew_dump() {
|
|||
<< "Vendor: " << (const char *)glGetString(GL_VENDOR) << endl
|
||||
<< "OpenGL version: " << (const char *)glGetString(GL_VERSION) << endl;
|
||||
|
||||
bool dumpall = false;
|
||||
if (dumpall) {
|
||||
string extensions((const char *)glGetString(GL_EXTENSIONS));
|
||||
replace_all( extensions, " ", "\n " );
|
||||
cerr << "Extensions: " << endl << " " << extensions << endl
|
||||
<< "Framebuffer and Stencil support:" << endl
|
||||
<< " GLEW_ARB_framebuffer_object: " << (bool)GLEW_ARB_framebuffer_object << endl
|
||||
<< " GLEW_EXT_framebuffer_object: " << (bool)GLEW_EXT_framebuffer_object << endl
|
||||
<< " GLEW_EXT_packed_depth_stencil: " << (bool)GLEW_EXT_packed_depth_stencil << endl
|
||||
<< " glewIsSupported(\"GL_ARB_framebuffer_object\"): " << (bool)glewIsSupported("GL_ARB_framebuffer_object") << endl
|
||||
<< " glewIsSupported(\"GL_EXT_framebuffer_object\"): " << (bool)glewIsSupported("GL_EXT_framebuffer_object") << endl
|
||||
<< " glewIsSupported(\"GL_EXT_packed_depth_stencil\"): " << (bool)glewIsSupported("GL_EXT_packed_depth_stencil") << endl;
|
||||
cerr << "Extensions: " << endl << " " << extensions << endl;
|
||||
}
|
||||
|
||||
cerr << " GLEW_ARB_framebuffer_object: " << ((GLEW_ARB_framebuffer_object==1) ? "yes" : "no" ) << endl
|
||||
<< " GLEW_EXT_framebuffer_object: " << ((GLEW_EXT_framebuffer_object==1) ? "yes" : "no") << endl
|
||||
<< " GLEW_EXT_packed_depth_stencil: " << ((GLEW_EXT_packed_depth_stencil==1) ? "yes" : "no") << endl;
|
||||
};
|
||||
|
||||
const char * gl_errors[] = {
|
||||
|
@ -33,14 +33,14 @@ const char * gl_errors[] = {
|
|||
"GL_OUT_OF_MEMORY" // 0x0503
|
||||
};
|
||||
|
||||
bool report_glerror(const char * task)
|
||||
bool report_glerror(const char * function)
|
||||
{
|
||||
GLenum tGLErr = glGetError();
|
||||
if (tGLErr != GL_NO_ERROR) {
|
||||
if ( (tGLErr-0x500)<=3 && (tGLErr-0x500)>=0 )
|
||||
cerr << "OpenGL error " << gl_errors[tGLErr-0x500] << " while " << task << endl;
|
||||
cerr << "OpenGL error " << gl_errors[tGLErr-0x500] << " after " << function << endl;
|
||||
else
|
||||
cerr << "OpenGL error " << hex << tGLErr << " while " << task << endl;
|
||||
cerr << "OpenGL error 0x" << hex << tGLErr << " after " << function << endl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue