Open rainman110 opened 1 year ago
If you would share a sample project it would be simpler to understand what you are trying to do / reproduce the problem
Sure, I'll provide the very quick and dirty example - based on yours - in a fork.
@gkv311 Here's the example on my fork in the branch "dual_view" https://github.com/rainman110/occt-samples-qopenglwidget/tree/dual_view
I extracted the viewer and the context into a separate objects "scene", which should hold the shared state.
@gkv311 Did you have any chance to look at the example. I am a bit puzzled, what could be happening.
Conceptually, what is required to have to separate viewers from the same scene?
@gkv311 Did you have any chance to look at the example. I am a bit puzzled, what could be happening.
Sorry, need to find some time to setup Linux + OCCT + sample environment. It might be tricky from OCCT side wrapping two existing OpenGL views sharing common context, though conceptually it should work.
Meanwhile I've pushed another option for splitting views using Subview API introduced by OCCT 7.7. Tested on Windows platform for now.
Awesome! I'll gonna try this latest tomorrow.
Strangely, I always successfully used a multi view application based on the old qt example, that is part of the occt examples.
Thank you for looking into it!
Strangely, I always successfully used a multi view application based on the old qt example, that is part of the occt examples.
You've missed the point about wrapping alien OpenGL context created by Qt (QOpenGlWidget
).
Old OCCT Qt samples do all OpenGL management on their own, taking from Qt only created native window handles.
Oh yes. You're right. With the new approach, there are two separate OpenGL contexts created by each of the qopenglwidgets. I am looking forward to look into your changed code.
I successfully used your example two create two separate views. it works out of the box.
Next, I tried to extract the
V3d_Viewer
andAIS_InteractiveContext
out of the widget to create a shared state between both views (i.e. have the same context with different views).In this case, the application crashes at the end of the second call to
initializeGL
, concretely at the linemyView->SetWindow
.This worked well with the "normal" occt qt examples, but does not work anymore with your
QOpenGlWidget
-based example.Do you have any suggestions, how I could use multiple views of the same context?