How can an OpenGL Vertex Array Object get deleted without calling glDeleteVertexArrays?

884 views Asked by At

I am developing an After Effects plugin where I use a VAO for OpenGL rendering. After full screen RAM preview the VAO, which has the handle number 1, is somehow deleted (glGenVertexArrays generates 1 again). The strange thing is that the shaders and framebuffers are still valid, so it's not the entire OpenGL context that gets reset. Does anyone know what could cause this?

1

There are 1 answers

0
datenwolf On

The most likely explanation is, that your plugin gets a completely newly created OpenGL context everything time happens. If your OpenGL context shared its "list" namespace with another "caching" context, and this sharing is re-established for the new context, you'd observe this behavior.

The strange thing is that the shaders and framebuffers are still valid, so it's not the entire OpenGL context that gets reset.

When establishing OpenGL context namespace sharing some kinds of objects are shared, i.e. get their "internal reference counts" (you can't directly access thise) incremented for each participating context, while others are not. Objects that hold data in any form (textures, buffer objects, shaders) are shared, while abstraction objects that hold state (array objects and framebuffer objects among them) are not.

So if a new context is created and a namespace sharing with the cache context established, you'll see all the textures, shaders and so on, you created previously, while VAOs and FBOs would disappear.

If you want to catch this situation use wglGetCurrentContext to get the OS handle. You can safely cast a windows handle to uintptr_t integer type, so for debugging you could print the value of the handle and look for if it changes.