diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/OffscreenContext.cc | 20 | ||||
| -rw-r--r-- | tests/fbo.cc | 8 | ||||
| -rw-r--r-- | tests/system-gl.cc | 26 | 
3 files changed, 27 insertions, 27 deletions
| diff --git a/tests/OffscreenContext.cc b/tests/OffscreenContext.cc index 7a3637c..e4045af 100644 --- a/tests/OffscreenContext.cc +++ b/tests/OffscreenContext.cc @@ -46,10 +46,10 @@ void offscreen_context_init(OffscreenContext &ctx, int width, int height)  static XErrorHandler original_xlib_handler = (XErrorHandler) NULL;  static bool XCreateWindow_failed = false; -static int XCreateWindow_error(Display *dpy, XErrorEvent *event)  +static int XCreateWindow_error(Display *dpy, XErrorEvent *event)  { -  cerr << "XCreateWindow failed: XID: " << event->resourceid  -        << " request: " << (int)event->request_code  +  cerr << "XCreateWindow failed: XID: " << event->resourceid +        << " request: " << (int)event->request_code          << " minor: " << (int)event->minor_code << "\n";    char description[1024];    XGetErrorText( dpy, event->error_code, description, 1023 ); @@ -58,7 +58,7 @@ static int XCreateWindow_error(Display *dpy, XErrorEvent *event)    return 0;  } -bool create_glx_dummy_window(OffscreenContext &ctx)  +bool create_glx_dummy_window(OffscreenContext &ctx)  {    /*    create a dummy X window without showing it. (without 'mapping' it) @@ -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;    } diff --git a/tests/fbo.cc b/tests/fbo.cc index 42dacaa..2978e59 100644 --- a/tests/fbo.cc +++ b/tests/fbo.cc @@ -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;    } diff --git a/tests/system-gl.cc b/tests/system-gl.cc index b7c7dd6..92dea5e 100644 --- a/tests/system-gl.cc +++ b/tests/system-gl.cc @@ -14,16 +14,16 @@ void glew_dump() {         << "Vendor: " << (const char *)glGetString(GL_VENDOR) << endl         << "OpenGL version: " << (const char *)glGetString(GL_VERSION) << endl; -  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; +  bool dumpall = false; +  if (dumpall) { +    string extensions((const char *)glGetString(GL_EXTENSIONS)); +    replace_all( extensions, " ", "\n " ); +    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; | 
