I use the QGLWidgets three-level hierarchy to exchange shaders and vertex data between 5 OpenGL widgets in my CAD-like application. The root context is used to compile shaders across the entire application, the document context is used to exchange data about the vertices of the model, and the viewing contexts are those that actually render (and also contain vertex data and other data for each view).
Shader sharing works fine and also makes the grid, but when it comes to exchanging vertex data, it fails and, frankly, I donβt see how it should work ...
I built a three-dimensional icon for the element while the model context was current, since it was the first VAO that had a "name" 1. When I came to draw the object, the viewport context (which is shared with remember the model context), so VAO 1 is invoked, but it displays the VAO 1 of the viewport drawn by my beautiful red grid. OpenGL contexts can be shared, but how can you specify a βnamespaceβ for each element since the names are not unique?
I tried to make the model context current just before calling the VAO of the model, but the correct VAO or viewport was drawn, I think that the switching context during the QPainter :: beginNativePainting () block does not make OpenGL happy.
This seems like a very simple thing to me, so I have to do something stupid - any suggestions?
source share