Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:52:56+00:00 2026-06-09T21:52:56+00:00

I am facing an odd problem with the OpenGL function glGenBuffers(). I’m writing a

  • 0

I am facing an odd problem with the OpenGL function glGenBuffers().
I’m writing a fairly simple application in which I use a VBO declared in the following way:

#include <QGLFunctions>
#include <QGLWidget>

class MyClass : public QGLWidget, protected QGLFunctions {
    GLuint vertexBufferObject;

    // ...
    GLuint makeBufferList(void);
}

GLuint MyClass::makeBufferList(void) {
    vertexBufferObject = 0;
    glGenBuffers(1, &vertexBufferObject);  // <-- Here it crashes

    // ... load data and render

    return vertexBufferList;
}

MyClass::MyClass(QWidget* parent) 
    : QGLWidget(parent),
      vertexBufferObject(0)
{
    QGLContext* context = new QGLContext(this->format());
    initializeGLFunctions(context);
    glInit();
}

MyClass::~MyClass() {
    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:

Maybe useful to know: I tried to compile exactly the same code on a Mac, using the GCC (Qt SDK) compiler, and both the Debug and Release Build work perfectly fine. But on Windows 7, the problem persists.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:52:57+00:00Added an answer on June 9, 2026 at 9:52 pm

    Found the the trouble (thanks to @MahmoudFayez): the problem comes from a bug in the Qt API, which makes the glGenBuffers() function (and possibly others as well) crash. The question is directly equivalent to the issue discussed here:

    • Unhandled Exception using glGenBuffer on Release mode only – QT
    • http://qt-project.org/forums/viewthread/12794

    The solution is relatively simple although not very elegant: use GLEW instead of QGLFunctions. I fixed my problem in the following way:

    #include "glew.h"
    #include <QGLWidget>
    
    class MyClass : public QGLWidget {
        // ...same as the above
    }
    
    MyClass::MyClass(QWidget* parent) 
        : QGLWidget(parent),
          vertexBufferObject(0)
    { 
        makeCurrent();
        glewInit();
    }
    

    This solved everything. A disadvantage is that this involves using an extra external dependency, whereas using Qt is all about being as compatible as possible, with as few external dependencies as you possibly can. However, it seems that we need to wait until Qt 5.0 is released before this bug may be fixed.

    As a final comment: I have not been able to figure out which part in this bug makes only the Release Build that crashes, but not the Debug mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im facing a Problem my HDD died and I lost many application which I
I am facing a rather odd problem with our groovy build script. The whole
iam facing problem in passing array to view. this is my controller code.. function
When facing the problem of validating a property in a JSF2 application there are
I'm facing an odd problem.... $string is user input $log = serialize(array('string' => $string);
I´m facing a huge problem since a couple weeks. I´ve an asp.net application hosted
I'm facing an odd problem with (re)packaging a Vagrant box and hope that maybe
I'm facing a bit of an odd problem here. I just launched: http://claudiu.phpfogapp.com/ To
I'm facing an odd behavior. I use the following code to send an HTTP
Im facing a problem where i want to schedule a certain java application to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.