mirror of
https://github.com/leozide/leocad.git
synced 2026-10-27 06:20:55 +00:00
Use Qt context for texture deletion
This commit is contained in:
1 parent
21bdbc9ec0
commit
404c8981f8
1 file changed
+16
-1
+16
-1
@@ -248,6 +248,21 @@ bool lcTexture::LoadImages()
|
||||
void lcTexture::Unload()
|
||||
{
|
||||
if (mTexture)
|
||||
glDeleteTextures(1, &mTexture);
|
||||
{
|
||||
QOpenGLContext* GLContext = QOpenGLContext::currentContext();
|
||||
|
||||
if (GLContext)
|
||||
GLContext->functions()->glDeleteTextures(1, &mTexture);
|
||||
else if (qApp && QThread::currentThread() == qApp->thread())
|
||||
{
|
||||
if (lcContext* Context = lcContext::GetGlobalOffscreenContext())
|
||||
{
|
||||
Context->MakeCurrent();
|
||||
|
||||
if (QOpenGLContext* OffscreenContext = QOpenGLContext::currentContext())
|
||||
OffscreenContext->functions()->glDeleteTextures(1, &mTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
mTexture = 0;
|
||||
}
|
||||
Reference in new issue
Block a user