PDA

View Full Version : QOpenGLTexture error: "Texture has not been destroyed"



giordi
9th April 2015, 13:23
Hi folks! I am using qt 5.4 for an opengl program.
So far so good, I quite like the new opengl wrap done by the Qt guys.
Only thing I am having hard time figure out is I keep getting an error when I close my app about the texture here the full error:

######
Requires a valid current OpenGL context.
Texture has not been destroyed
######

I tried to manually destroy the buffer in the destructor or trying to catch the close event and destroy the texture there but no luck.
Googling around I found some people flagging a bug report for it but I did not understand if it was accepted or not.
Anyone had this problem and actually solved it?

Cheers
M.

Added after 17 minutes:

Actually had this problem for a couple of days and found the answer by myself 3 minutes after posting this,lol, meanwhile I was looking for info about when initializeGL() gets called.
Anyway if anyone is interested in the answer (which is also in the doc) is that Qt doesn't guarantee that the context is current at clean up time so we must explicitly make that so by calling the makeCurrent() function before doing any clean up. That fixed the error :)
Cheers