osgearth icon indicating copy to clipboard operation
osgearth copied to clipboard

Cesium native - Assertion error

Open gwaldron opened this issue 7 months ago • 2 comments

@ChahuaP says: Hello, I'm using osgEarth 3.5 and Cesium-native to visualize local 3D Tiles files in osgEarth. However, during the usage, when I try to load 3D Tiles with my code, the program throws an error "Assertion failed: std::this_thread::get_id() == this->_threadID, file G:\download\cesium-native-0.24.0\CesiumUtility\include\CesiumUtility/ReferenceCountedNonThreadSafe.h, line 60". My code is as follows:

auto cesiumLayer = new osgEarth::Cesium::CesiumNative3DTilesLayer; cesiumLayer->setURL("G:/download/cesium-native-0.24.0/Cesium3DTilesReader/test/data/tileset.json"); mapNode->getMap()->addLayer(cesiumLayer);

I hope to receive your assistance,thank you.

Originally posted by @ChahuaP in https://github.com/gwaldron/osgearth/discussions/2364#discussioncomment-7455329

gwaldron avatar Nov 07 '23 21:11 gwaldron

What version of Cesium Native are you using? Try using git sha 952b17446b960190b2989085b7bdb23f4ccb2d27 of Cesium Native if you would and report back, that is what I was testing against.

jasonbeverage avatar Nov 07 '23 21:11 jasonbeverage

Hello, I tested the versions cesium-native 0.24-0.29, they all produced errors. My error occurred in the releaseReference of the ReferenceCounterNonThreadSafe file in Cesium-Native.

I initially estimated that it was a multi-threading error, because Openthread will generate multi-threading when calling osg, so after creating the osgviewer, I added viewer->setthreadingmodel(osgviewer::viewerbase::singlethreaded). This line solved the reporting error problem.

In addition, I also found that using osgearth 3.5 to load 3dtiles without any textures would also report errors. Therefore, I modified the code for generating 3dtiles textures in the source code, and finally successfully loaded the 3dtiles. Since I'm just a student with limited programming skills, although I solved the problems I encountered when using Osgearth, the solutions may be wrong, just for your reference. The attached figures show my thread error location and adjustments to the source code. Thank you for your reply.

ChahuaP avatar Nov 08 '23 02:11 ChahuaP