OpenGL and CachedImage


I need to update one of the images in the OpenGL context so I do a: getPixelData()->sendDataChangeMessage();


This in turn calls the CachedImageList::imageDataChanged which in turn calls release on the texture. The problem is that when this happens the context is not active and so does not delete the texture.


void OpenGLTexture::release()


    if (textureID != 0

         && ownerContext == OpenGLContext::getCurrentContext())


        glDeleteTextures (1, &textureID);

        textureID = 0;

        width = 0;

        height = 0;




What is the best way to go about sending the changed flag as it is always on the main message thread and the context is not active at the time?




That's an internal method, you shouldn't be calling it directly from your code.. The idea is that GL will reload the texture automatically when it needs to, if you've changed the data. Just use the normal ways of drawing to the image, and it should be fine.