I would like to create a 3D scene using Qt (version 5.11).
I would like to map a JPG image on nearly-infinite sphere, to support background of the 3D scene.
Here is the related source code:
Qt3DCore::QEntity *aGalaxyBackground = new Qt3DCore::QEntity(rootEntity);
Qt3DExtras::QSphereMesh* aGalaxyBackgroundSphereMesh = new Qt3DExtras::QSphereMesh();
aGalaxyBackgroundSphereMesh->setRadius(100);
aGalaxyBackground->addComponent(aGalaxyBackgroundSphereMesh);
Qt3DRender::QTextureLoader* aGalaxyBackgroundLoader = new Qt3DRender::QTextureLoader(aGalaxyBackground);
Qt3DExtras::QTextureMaterial* aGalaxyBackgroundMaterial = new Qt3DExtras::QTextureMaterial(aGalaxyBackground);
aGalaxyBackgroundLoader->setSource(QUrl::fromLocalFile("D:/Qt/starfield.jpg"));
aGalaxyBackgroundMaterial->setTexture(aGalaxyBackgroundLoader);
aGalaxyBackground->addComponent(aGalaxyBackgroundMaterial);
The problem with this approach is that the JPG is mapped on the "outside" surface of the sphere. When the camera is in the inside of the sphere, the background is not visible.
What is wrong with this approach?