Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osgViewer::CompositeViewer missing? #37

Open
unelsson opened this issue Apr 19, 2020 · 4 comments
Open

osgViewer::CompositeViewer missing? #37

unelsson opened this issue Apr 19, 2020 · 4 comments

Comments

@unelsson
Copy link

unelsson commented Apr 19, 2020

I'm trying to update osgQt in project OpenMW-CS ( https://github.com/openmw/openmw ), a game world editor that should work with one or more windows and widgets. In that application, Qt widgets should be able to provide various different views. The previous OpenMW-CS version uses older osgQt, which was compatible with osgViewer::CompositeViewer.

The latest osgQt provides OSGRenderer, which uses osgViewer::Viewer. Is it possible to use osgViewer::CompositeViewer? Is it intentional that it's left out, or is it maybe a WIP?

To provide a context, my ongoing work is at OpenMW/openmw#2786 , even if there isn't much to look at right now.

Thank you for your help.

@unelsson
Copy link
Author

The following commits modify osgQOpenGLWidget and OSGRenderer to use osgViewer::CompositeViewer instead of osgViewer::Viewer. They can't be directly merged, but may be helpful examples for further development.
OpenMW/openmw@cf8eedd
OpenMW/openmw@23c9c57

@unelsson
Copy link
Author

unelsson commented Dec 2, 2020

Here are two classes: updated osgQOpenGLWidget and CompositeOsgRenderer, which is a version of OSGRenderer that uses osgViewer::CompositeRenderer. I've unfortunately ran into rendering errors while using it - in OpenMW-CS objects don't randomly render as visible objects even when they are clearly editable in the scene. Also the floating mode of the widget causes error Warning: detected OpenGL error 'invalid value' at after RenderBin::draw(..). With these errors and lack of compatibility with osgQOpenGLWidget that uses osgRenderer(osgViewer::Viewer) can't be directly merged via a PR, but maybe these can provide useful for later development.

https://github.com/unelsson/openmw/tree/osgqopengl_2/extern/osgQt

Example use code (not minimal example...)
https://github.com/unelsson/openmw/blob/2bb606b31d0fbed3919ff6d393c14a15e8a36c3a/apps/opencs/view/render/scenewidget.cpp#L78

@unelsson
Copy link
Author

unelsson commented Dec 4, 2020

Here is a more minimal example of CompositeOSGRenderer use. The example osgViewerQt_CompositeViewer.cpp aims to emulate and test osgViewer::CompositeViewer with Qt5's windows/widgets, especially test QOpenGLWidget inside floating QDockWidget.

I think something like this should eventually get to osgQt codebase, but it should be somehow compatible with OSGRenderer and QOpenGLWidget and QOpenGLWindow (not just separate versions of them). Any suggestions on this? And how complete should the feature be before making a PR?

https://gitlab.com/unelsson/osgqt_tests/-/tree/master

@mathieu
Copy link
Collaborator

mathieu commented Apr 1, 2021

This a access to the OpenGL graphic context issue.
Drawing needs to happen in Qt's main thread.
Composite Viewer will create threads for rendering, and those will need a valid GC (which they won't because of Qt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants