I'm porting my C++ GLFW-based game engine to BOO & OpenTK.
One of the major problems I encountered is implementing Shutdown logic. This logic is designed to destroy all objects that use GL context-depending data to be actually destroyed in GameWindow::Unload() method, just before the context itself is destroyed. In C++ I just had smart pointers that did all the job perfectly, except that I had to do my own reference counting. How can one implement shutdown logic in .NET properly?
Right now Garbage Collector tries to destroy my Shader objects after the GameWindow closed, causing exceptions to rise on GL.DeleteShader. The same with textures & VBO's. One of possible solutions is to perform try-except on any GL resource freeing. Is there a more proper way?