[Interest] Crash inside QOpenGLDebugLogger with Qt 5.2 / VS2012

Roger Leigh rleigh at codelibre.net
Sun Apr 13 15:05:51 CEST 2014


I have a test Qt OpenGL program here:
https://github.com/rleigh-dundee/bioformats-examples/tree/view2d-2/cpp/glview

The program is working absolutely fine on Linux and MacOSX.
Today, I tried building and running with VS2012 (x64) on Windows 7.

Building is fine, after a few minor tweaks.  However, it crashes
hard when setting up the GL debug logging.  (If I comment out just
the startLogging() call, it all works perfectly.)

When I run the program, I see:

H:\code\bioformats-examples\cpp\glview\win>Debug\glview.exe
Made context current
Created debug logger
Init logger
QWindowsGLContext::getProcAddress: Unable to resolve 'glGetPointerv'
Start logging
[crash]

The actual code in question follows.  This is presumably because I'm
doing something in the wrong order, or the debuglogger is broken on
Windows since it works on Linux and MacOS.  I know for sure I
created an OpenGL context and made it current.  It looks odd though
- logger->initialize() fails to resolve glGetPointerv
- logger->initialize() returns true, despite that

Has anyone used the QOpenGLDebugLogger on Windows successfully?

Debugging on Windows seems a pain as well; I haven't been able to
get a stack trace of any sort.  I get:
Unhandled exception at 0x0000000000000000 in glview.exe: 0xC000041D: An unhandled exception was encountered during a user callback.  And the main
thread is 0000000000000000.
Not sure if that means the stack was completely blown away, or just
that the MS tools are poor.


Any thoughts would be greatly appreciated.

Thanks,
Roger

// Derived from public QWindow, protected QOpenGLFunctions
void GLWindow::renderNow()
{
  if (!isExposed())
    return;

  bool needsInitialize = false;

  if (!glcontext) {
    QSurfaceFormat format = requestedFormat();
    // OpenGL 2.0 profile with debugging.
    format.setVersion(2, 0);
    format.setProfile(QSurfaceFormat::NoProfile);
//#ifdef BIOFORMATS_OPENGL_DEBUG
    format.setOption(QSurfaceFormat::DebugContext);
//#endif // BIOFORMATS_OPENGL_DEBUG
    format.setSamples(4);

    glcontext = new QOpenGLContext(this);
    glcontext->setFormat(format);
    glcontext->create();
    makeCurrent();

    std::cerr << "Made context current" << std::endl;

    logger = new QOpenGLDebugLogger(this);
	std::cerr << "Created debug logger" << std::endl;
    connect(logger, SIGNAL(messageLogged(QOpenGLDebugMessage)),
             this, SLOT(logMessage(QOpenGLDebugMessage)),
             Qt::DirectConnection);
	std::cerr << "Init logger" << std::endl;
    if (logger->initialize()) { // QWindowsGLContext::getProcAddress: Unable to resolve 'glGetPointerv'
	  std::cerr << "Start logging" << std::endl;
      logger->startLogging(QOpenGLDebugLogger::SynchronousLogging); // Program crashes
	  std::cerr << "Enable log messages" << std::endl;
      logger->enableMessages();
	  std::cerr << "Logger running" << std::endl;
    }

    needsInitialize = true;
  }

  makeCurrent();

  if (needsInitialize) {
    initializeOpenGLFunctions();
    initialize();
  }

  render();

  glcontext->swapBuffers(this);

  if (animating)
    renderLater();
}



-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800



More information about the Interest mailing list