The software I’m working on uses multiple vtkCocoaGLView instances to display stuff. Since updating to recent VTK versions from VTK 5, the rendering pipeline stops working when switching between windows.
I tracked this down to an unbound vtkShaderProgram, where the corresponding vtkOpenGLShaderCache thinks the shader is bound, but it’s actually not. If using the debugger I ->Bind() the shader, the views are rendering again, until I switch windows again.
Any suggestions, how to fix this?
Maybe something outside of VTK is binding a different shader which the cache does not know about. In cases like that it can be fixed by calling something like
- Release the current shader. Basically go back to
- having no shaders loaded. This is useful for old
- legacy code that relies on no shaders being loaded.
at the end of your render (or right before it) either way it should force VTK to rebind the shader
Thanks for the suggestion. It only temporarily resolved my problem, but it came back later on anyway.
I found a fix: the original code used to draw a ‘disabled’ status of the view using macos specific drawing APIs, then passing control over to VTK. That probably messed with the OpenGL stack.
I cleared the custom code and it no longer misbehaves.