Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
4.7.3
-
None
-
Windows 7, Qt 4.7.4, Qt 3D from https://gitorious.org/qt-quick3d/qt-quick3d
Description
I am reading a 3D model using QGLAbstractScene::loadScene(), I access a subnode and try to texture it with a QGLMaterial. It seems the texturing is not applied to the subnode.
Here is an outline of the code I have:
// Read in the 3D model, QGLAbstractScene *m_modelScene = QGLAbstractScene::loadScene(fileName); // This will print: ("smartphone.3DS", "<3DSRoot>", "phone", "button", "screen", "phone::m_phone", "button::m_button", "screen::m_screen") qDebug() << m_modelScene->objectNames(); // Access the main node and the subnode that we want to texture. QGLSceneNode *m_meshObject = m_modelScene->mainNode(); QSceneNode *displayNode = qobject_cast<QGLSceneNode *>(m_modelScene->object(QLatin1String("screen"))); // Create the texture we want to apply to the subnode "screen". Use existing image for texturing. QGLMaterial *materialTexture = new QGLMaterial(this); QUrl url; url.setPath(QLatin1String(":/smartp0.png")); url.setScheme(QLatin1String("file")); materialTexture->setTextureUrl(url); // Set the texturing material and draw the model. displayNode->setMaterial(materialTexture); m_meshObject->draw(painter);
The subnode is, however, not textured with the new image but instead the model is shown as defined as modelled in 3D Studio.
A test application that can be compiled to test this issue can be found here:
https://gitorious.org/kypeli-s-qt3d-playground/qt3d-texture-subnode/commits/image_texture
Files can be browsed here:
https://gitorious.org/kypeli-s-qt3d-playground/qt3d-texture-subnode/trees/image_texture
And finally, the code is a remote branch called "image_texture" of this project:
https://gitorious.org/kypeli-s-qt3d-playground/qt3d-texture-subnode