fhwedel-hoe / OpenRoadEd

OpenRoadEd is a simple application designed to create both logical (OpenDRIVE standard) and geometrical (OpenSceneGraph) descriptions of road networks.
Other
156 stars 65 forks source link

Display does not work properly #3

Closed fhwedel-hoe closed 3 years ago

fhwedel-hoe commented 5 years ago

Due to the changes in OSGMain.cpp, the OpenSceneGraph is no longer attached to the Qt Widget it is supposed to be drawn on. This was previously implemented in a Windows-only way. This needs to be re-done in a proper manner, such as the example shows.

screenshot

I have no experience with Qt or OpenSceneGraph whatsoever. Any help on this is appreciated.

karolmateusznowak commented 3 years ago

You could replace Qt with imgui

fhwedel-hoe commented 3 years ago

@karolmateusznowak Switching to imgui would be an extensive change. Sticking to Qt is easier. There must be someone out there who knows how to integrate OpenSceneGraph into a Qt widget. I am sure, for them this is an easy fix.

ebadi commented 3 years ago

@fhwedel-hoe Qt 4.8.7 is discontinued on December 2015 and many linux distros moved to Qt5 and therefore I thought it is good idea to port OpenRoadEd to Qt 5 to be able to get support from Qt community as well. Icons are missing but I doubt it is a serious issue that I need to focus on now. I guess that there are other issues with this port since I cannot do anything with tool, would it be possible for you to try it and see if it has the same functionalities as the build based on Qt4?

image

With this said, is it possible for you to give me more hints on what has to be done to fix these issues? What has been done correctly in the example you mentioned that is missing in the current implementation?

fhwedel-hoe commented 3 years ago

Yes, your branch works. With "works" as in "not more broken than it has been before". ;) Good job. 👍
grafik

The icons are not compiled in, but rather read from the working directory. The working directory must contain the "Resources" folder.

Please note I merely forked the repository, noticed the display is not working out of the box and then decided to leave it to someone else, as I have no experience with Qt or OpenSceneGraph.

In the original, there is this line traits->inheritedWindowData = new WindowData(window); which – as far as I understand – reads the information from window and tells OpenSceneGraph "this is the window you should use to display yourself on". Unfortunately, this feature seems to be Windows only (window is a win32 handle). :( I could not make heads or tails of the platform-independent example. It seems to use a completely different approach which "just works".

ebadi commented 3 years ago

The icons are not compiled in, but rather read from the working directory. The working directory must contain the "Resources" folder.

Thanks for this hint and testing my work. It seems that you loaded the same open drive file with the version that I am working on. I actually cannot open any of my opendrive files.

Please note I merely forked the repository, noticed the display is not working out of the box and then decided to leave it to someone else, as I have no experience with Qt or OpenSceneGraph.

Me neither but I would like to give it a try. Thanks for the pointer.

I guess I need to convert #include <osgViewer/api/Win32/GraphicsWindowWin32> to #include <osgViewer/api/X11/GraphicsWindowX11> or <osgViewer/api/Win32/GraphicsWindow> and move forward.

I found that someone has already done something similar before here. I will try to see if we can use it when I find some time.

fhwedel-hoe commented 3 years ago

Thanks for this hint and testing my work. It seems that you loaded the same open drive file with the version that I am working on. I actually cannot open any of my opendrive files.

You are right, I opened the file in the github repo. Like many others these days, I am working from home a lot and do not have other files at hand. From the top of my head, I remember that OpenRoadEd supports only one kind of turns (either polyline or arc), but not the other one, which happens to be popular. Due to the issue with the display, I never even tried to expand OpenRoadEd's support for turns.

I found that someone has already done something similar (…).

Using winId() sounds promising. I did not even know that existed. :D

ebadi commented 3 years ago

Hi,

I remember that OpenRoadEd supports only one kind of turns (either polyline or arc), but not the other one

That explains it

Using winId() sounds promising. I did not even know that existed. :D

WinId() was actually the solution. :) Do you prefer that I send a pull request fixing this issue separately or do you want me to send a giant pull request with QT5 port + the fix altogether? I am planning to clean up the documentation and the build script next. Would it be possible for you to close this issue, go through your issue list above and create separate issue for those that are critical to be fixed?

fhwedel-hoe commented 3 years ago

Nice work, very good!

I merged your commits, did some tests and adjusted the code to for compatibility on Windows. The display is now working better, although not perfect. Mouse navigation does not seem to work at all, but that is as good as it gets for now, I guess. :)

ebadi commented 3 years ago

Thanks. I fixed few minor issues in the documentation and send the pull request https://github.com/fhwedel-hoe/OpenRoadEd/pull/7

This can be skipped if osgQt in your system is reasonably recent.

Interesting! How did you install osgQt and what version are you at? As far as I remember, when I get the prepackaged software via apt-get, there were several files ( in /usr/lib or /usr/include) that were missing. I therefore build an older version of the osgQt, (hence git checkout 6e4de) . Would be nice to double check this and possibly remove this extra step from the instruction.

fhwedel-hoe commented 3 years ago

@ebadi On Ubuntu 18.04, I ran apt-get install libopenscenegraph-dev. It installed version 3.2.3 which just worked out of the box. On Windows, I used vcpkg which builds version 3.6.5.

Note: In 324a7d5, I replaced pkg_check_modules(OSG REQUIRED openscenegraph) by find_package(OpenSceneGraph…). Maybe the pgk-config files supplied by openscenegraph are no longer maintained?

ebadi commented 3 years ago

@fhwedel-hoe On ubuntu 20.04 apt-get install libopenscenegraph-dev results in Version: 3.6.4+dfsg1-3build2 to be installed (which is very similar to the version that you use for building on Windows!!!) but I get the following error on build:

...
[ 38%] Building CXX object CMakeFiles/OpenRoadEd.dir/Osg/OSGMain.cpp.o
/home/test/OpenRoadEd/OpenRoadEd/Osg/OSGMain.cpp:15:10: fatal error: osgQt/GraphicsWindowQt: No such file or directory
   15 | #include <osgQt/GraphicsWindowQt>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/OpenRoadEd.dir/build.make:349: CMakeFiles/OpenRoadEd.dir/Osg/OSGMain.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/OpenRoadEd.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I tried to put back the line that you replaced but nothing changed.

find_package(PkgConfig) 
pkg_check_modules(OSG REQUIRED openscenegraph)

So the newer versions of libopenscenegraph-dev breaks the build instruction and therefore we need to downgrade to an older version of osgQt. I updated the readme file here: https://github.com/fhwedel-hoe/OpenRoadEd/pull/11

Another solution is to install an older version of libopenscenegraph-dev with apt-get but I don't recommend it as this sometimes break dependencies.

fhwedel-hoe commented 3 years ago

Indeed. It looks like Ubuntu 20.04 "focal" and Debian 11 "Bullseye" do not include osgQt in their openscenegraph packages.