BindTexture crash in release version
I encountered a strange problem recently. I'm creating a program which uses OpenGL via a QGLWidget. It works perfectly on Linux and compiled as debug version on Windows, but as a release version it crashes - or, actually, it starts, doesn't display a window and just silently exits. Through outputting some debug strings I managed to find the offending part of code:
tex_sky = bindTexture(*sky); // <- this line@
Those lines are in the function GraphicsWidget::initializeGL() (where GraphicsWidget is a subclass of QGLWidget and QGLFunctions). tex_sky is declared as a GLuint property of the class, sky is declared as a pointer to QImage and initialized in the constructor with
@sky = new QImage("sky.jpg");@
I don't see any reason this shouldn't work, and in fact as I said it works - on Linux and in the debug version. Why this fails in the release version is beyond me.
I also sent the application to some of my friends - all of them reported the same behaviour: they double-click on the .exe and nothing happens (I checked with the Task Manager that it actually launches, but silently exits after a short while).
Am I doing something wrong? Or is it possible that it is a bug in the release version of the Qt libraries? A bug in the graphics drivers is pretty much ruled out by the fact that it was the same on my friends' machines.
Any help will be greatly appreciated.
I'm just bumping to say that I found a solution. Apparently it was glActiveTexture that caused the problem. I used GLEE instead of QGLFunctions and it started working.