osgearth
osgearth copied to clipboard
The earth globe appears weird when adding a SkyNode
I encountered a strange problem when adding a SkyNode onto the globe, which has bothered me for several days.
The problem is that if I don't add the sky node, everything works fine, but after I add the sky node, the problem in the picture below appears. There are something like longitude and latitude lines on the earth, still with some red/green/yellow triangle faces.
(I removed the earth file to better visualize the problem.)
The osgearth_viewer.exe application has the same problem too, as belows:
The codes i used to initial the earth viewer were very simple:
osgEarth::Util::SkyNode* m_pSkyNode = osgEarth::Util::SkyNode::create(skyOptions);
m_pSkyNode->setName("SkyNode");
m_pSkyNode->setEphemeris(ephemeris);
m_pSkyNode->setDateTime(dateTime);
pViewer->setLightingMode(osg::View::SKY_LIGHT);
m_pSkyNode->attach(pViewer, 0);
m_pSkyNode->setLighting(true);
m_pSkyNode->setAtmosphereVisible(false);
m_pSkyNode->addChild(mapNode);
root->addChild(m_pSkyNode);
There is another interesting thing, If I comment out the codes bellow which i added in the main.cpp before the QApplication's Constructor:
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
#ifdef OSG_GL3_AVAILABLE
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setOption(QSurfaceFormat::DebugContext);
qDebug() << QObject::tr("OPENGL3");
#else
format.setVersion(2, 0);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setOption(QSurfaceFormat::DebugContext);
qDebug() << QObject::tr("OPENGL2");
#endif
format.setDepthBufferSize(24);
//format.setAlphaBufferSize(8);
format.setSamples(8);
format.setStencilBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
QSurfaceFormat::setDefaultFormat(format);
The longitude and latitude lines thing disappear, but the red/green/yellow triangle faces still remains :
So, maybe it's a bug about OpenGL , I guess?
My compiling environments: Windows 11 , VS 2019, vcpkg
Here is the osgearth version information: [osgearth info] [Capabilities] osgEarth Version: 3.5.0 build 149 [osgearth info] [Capabilities] GDAL Version: 3.8.2 [osgearth info] [Capabilities] OSG Version: 3.6.5 [osgearth info] [Capabilities] OSG GL3 Features: yes [osgearth info] [Capabilities] OSG FFP Available: no [osgearth info] [Capabilities] CPU Cores: 12 [osgearth info] [Capabilities] GL_VENDOR: NVIDIA Corporation [osgearth info] [Capabilities] GL_RENDERER: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 [osgearth info] [Capabilities] GL_VERSION: 3.3.0 NVIDIA 546.33 [osgearth info] [Capabilities] GL CORE Profile: yes
I am really confused on this. Has anyone encountered the same problem? Please help me, many thanks!
If i comment out the QSurfaceFormat codes, the stars in the sky disappear too, but the sun remains.