QT 5.2 Cesium embedding

Hi, I'm trying to embedd Cesium in a QT 5.2 application in order to have a stand-alone version.

I started coding but I'm facing fluency issues since that when I load the CesiumViewer in a QGraphicsWebView the framePerSecond rate dramatically slows down, I suppose that i'm dealing wrong with QT settings.
I have post my code here:

Any ideas or suggestings to reach my goal?
Thanks

I don’t have any experience here, but this thread may be useful:

Redirecting to Google Groups

Patrick

While I’m no Qt expert, I have done some experiments in the past with embedding Cesium in a simple Qt app. I don’t recall any performance issues. What platform are working on? Did you build Qt yourself or are you using pre-built binaries? I assume Cesium runs fast in a web browser on the same machine?

Hi Matthew, right now i'm using qt creator 3.1.0 based on qt 5.2.1. I'm new to qt so I simply download the qt online installer for windows from the website.
Can you explain me better what you mean with this: "Did you build Qt yourself or are you using pre-built binaries?"

As i said here:


using a qwebView I'm not able to reach the same fps rate reached with the browser when loading just a cesium.Viewer from an html file embedded with the cesium library in the qrc resources.
If I try to load a more complex scene directly from internet like this one: http://cesiumjs.org/LotsOfSatellites/
my qt app try to load it and then freezes.
I don't now if that issue depends on the javascript engine used by qt,
or if there is the possibility to built qt for a specific machine in order to get better results, or even more i'm dealing wrong with the settings of my application. I'm just supposing.

Please can you look at my code on stackOverFlow at the above link, just to tell me if there are any errors in my creation process, and in my approach to the development.

Thank you in advance!

Did you actually upload any usable data into Cesium once it was embedded into your Qt app? I have found that adding a simple entity/primitive does not have any affect on performance, but once you’ve loaded lots of data (via CzmlDataSource/KmlDataSource), performance deteriorates, you get very choppy movements, and double clicking any of the loaded items causes it to crash.

The last time I tried was probably over 2 years ago, so you got me curious and at first glance it looks like you are correct. Using the browser example that ships with Qt, anything non-trivial is slow. This appears to be a problem with how Qt implements their WebKit based engine and not a problem with WebKit itself. Some googling revealed lots of people complaining about Qt browser performance. Unless I’m missing something, I’m afraid that Qt’s browser implementation simply isn’t good enough to run Cesium and there’s little to nothing we can do on Cesium’s end to change that.

One possibility would be to use something like CEF (https://bitbucket.org/chromiumembedded/cef) instead, I believe several people on the mailing list have had success with it, but I haven’t personally used it. If you are on Windows only, then Microsofts browser control may also be a good fit.

Sorry I don’t have better news. If you find any tips and tricks for tuning Qt to run Cesium better, We would love to hear it and it will be useful for others trying to do the same thing.

Hi, and sorry for the delay, I can't add any good advice to what Mark said.

I tried using both QWebView and QGraphicsWebView classes to display a
Cesium scene with the same results, finally I had to accept the slow
frame rate and work with no more than 3 polygons at time (primitives,
not CZML/KML).

For your information I used: QT 4.8 and Cesium 1.0.

Good Luck!

Something is just not right. Can you post any sample code so we can see what is going on?

Here’s a sample project demoing the sluggishness, I can not provide the czml file used as it is project related and can not be shared.

CesiumAndQtTest.zip (2.98 KB)

I can’t reproduce any sluggishness. You can use the Sandcastle on your local machine/build, replacing your CZML into this sample.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
selectionIndicator : false,
infoBox : false
});

function loadKmlData() {
viewer.dataSources.add(Cesium.KmlDataSource.load(’…/…/SampleData/kml/facilities/facilities.kml’));
}

function loadCzmlData() {
viewer.dataSources.add(Cesium.CzmlDataSource.load(’…/…/SampleData/Vehicle.czml’));
}

function clearData() {
viewer.dataSources.removeAll();
}

Sandcastle.addDefaultToolbarButton(‘Load KML Data’, loadKmlData);

Sandcastle.addDefaultToolbarButton(‘Load CZML Data’, loadCzmlData);

Sandcastle.addDefaultToolbarButton(‘Clear Data’, clearData);

``

How big of a czml file are you dealing with?

I think we got off track, there is no sluggishness running in sandcastle, only when embedding in a Qt application. Simply loading the facilities.kml file (provided in Sample Data of Cesium 1.9 download) will slow down response time in a Qt application (debug or release). My czml file is 5 MB. Matthew Amato already confirmed the sluggishness upthread.

Mike, were you running from inside a Qt application? As I stated in my reply, I think the problem here is Qt’s WebKit integration/perfornance itself. I can easily reproduce the sluggishness that k1mray2000 is seeing. Can you confirm how you tested for me. If it is on Qt, I wouldn’t mind taking a look at your machine to see what the difference may be.

Just an FYI, disabling network adapters (used by virtual machines) in Device Manager solved the sluggishness for me.