PySide OpenGL Contexts
-
OK so I have been running around in circles with the documentation trying to understand the whole context design. It's very confusing and everything I have tried either results in a black canvas or it crashes.
This is what I am wanting to do.
I have a 3D can like editor that is rendered using OpenGL. What is being rendered are 3D meshes and the meshes can be upwards of a million triangles or a mesh can be used in more than one location. I have shader code written that handles positioning, scaling and rotation of the meshes. That means the meshes are uploaded to the GPU's RAM and this is done a single time per mesh. I need to have another canvas that would be available on demand that is used for alignment of objects that connect to the mesh. Think part assemblies. I should be able to share contexts between the 2 canvases so I don't have to upload a second copy of the mesh to the GPU's RAM. I should be able to use the one that already exists in the RAM. This is where I am not having any luck. One location in the documentation mentions using AA_ShareOpenGLContexts but setting that doesn't work and results in the main canvas not rendering anything. There is also QOpenGLContext and in the documentation it shows there is a function named setShareContext but it needs to be passed a context that it is supposed to be sharing with but doesn't explain where to get that context from. there is also the function globalShareContext which is apart of that class as well but once again the description is rather vague as to what it's use would be.
If someone could help me out with understanding the relationships of these things and how to get context staring working it would be appreciated.
-
Hi,
From old memories, you need to create the initial context first and then share it with the others and don't forget the creat calls.
This Reddit thread might be what you are looking for.