Hi,
I writing here as I’m trying to figure out what’s the best way of handling this.
I have multiple OpenGL ‘sub-classes’ being called by my main class. (within proper OpenGL context)
When my parent is being destructed it calls executeOnGLThreadwith blocking (so my destructor would wait).
It works well in Standalone, AU, VST, AAX.
But on VST3 I hit:
jassertfalse; // you called execute AFTER you detached your openglcontext
Sadly, it seems there’s no way knowing we’re going to be destroyed since,
In the destructor of your class call shutdownOpenGL();. That will call detach and stop the openGL thread.
But it won’t destroy the resources yet.
Instead you get the callback shutdown(); where you can safely now destroy your resources e.g. OpenGLTextures.
The OpenGLContext will then be destroyed just normal when the base class goes out of scope.
I have a ‘parent’ class which is an OpenGLRenderer that calls childrens which are being called by the parent class with its context (so there’s single context shared between children).