Nominate our 2022 Qt Champions!

GlGenBuffers() crashes in Release Build

  • Hello everyone!

    I am facing a very odd problem with the OpenGL function glGenBuffers(). In order to use all OpenGL functions, I defined my class like this:

    @class MyClasss: protected QGLFunctions {
    // ...

    GLuint vertexBufferObject;

    I'm writing a fairly simple application in which I use a VBO declared in the following way:
    glGenBuffers(1, &vertexBufferObject);
    // ... load data and render

    // ...and in the destructor:
    glDeleteBuffers(1, &vertexBufferObject);

    This all works perfectly fine in the Debug Build. The data is rendered nicely and all and the programme finishes correctly in the end. However, in Release Build, the glGenBuffers() crashes the programme. It doesn't just return 0 or do nothing, it crashes right at the function call. But since the problem only occurs in Release mode, I can't use the debugger to find out what's going wrong.

    I'm working on a Windows 7 system and developing in Qt 4.8.1. The compiler is the MSVC 2010 (Qt SDK) compiler.

    Does anyone have any suggestions that I might try?

    // Edit:
    And yes, I rebuilt like a hundred times and ran qmake again and again, with no result.
    Also, I put debugging output statements throughout the code to see if this was actually where it went wrong, like this:
    @qDebug() << "GL error:" << glGetError();@

    All return 0, until the programme hit glGenBuffers(), at which point it crashes.

  • Ah, I found that it is most likely equivalent to the problem described here:

    It is postulated in this thread that the problem is caused by a bug in the Qt API, this one:

    I would be grateful if anyone could confirm that - it doesn't completely seem to match up in my mind, although it may well be possible. My current work-around is to use GLEW instead and leave out QGLFunctions, but I would be happy to hear of other (neater) solutions.

Log in to reply