Qt Font being damaged when deleting glDeleteTextures on ios
-
I am having a odd problem that makes me wonder if there is a bug in Qt. I am writing a 3D model viewer for a iphone. And I am using Qt widgets to make interface buttons for the user to interact with the app. (btw, This is entirely a internal studio tool--not meant to be released on the app store).
I have a few buttons that the user can touch which will load and unload openGL content. I have one in particular that purges all openGL content currently loaded. Whenever I click the button, the content unloads as expected. But suddenly the font in my log portion of the window loses its font and draws blocky black characters. I have attached a image that shows the problem. This is running on a iPad Air 2.
!http://i.imgur.com/2YBJ7x4.png(Example of what happens to Qt's font)!
The interesting thing is, this problem only occurs when I run the command by pressing the Qt widget button. If I call the command through the command prompt it doesn't happen.
My theory is, when I am deleting the openGL content in my app, that I'm not in my openGL context. I'm not sure how I did that. I wondered if when the Qt button is pressed, somehow the context is switched out briefly. Perhaps my code comes along and starts deleting openGL texture buffers. Maybe my delete command is actually deleting texture buffers used by Qt. Earlier, this problem was causing the button images to turn black. So Maybe I'm onto something there.
btw, here's the code that does the deleting:
@void GPUTextureOGL::deleteTexture()
{
if( m_texturegl) {
qDebug() << m_name << " deleting OGL:" << m_texturegl;
glDeleteTextures(1, &m_texturegl);
}
m_texturegl = 0;
}@This problem does not occur on the desktop version of the app. Just on my ipad.