PDA

View Full Version : QGLSphere and texture mapping (Qt5)



spirits25
23rd October 2012, 10:23
Hi.
Sorry, but I'm bad speak English=)
I use Qt5 and Qt3D module. I created qglsphere object as in example "solarsystem":


QGLBuilder builder;
QGLSceneNode *root = builder.sceneNode();
QUrl url;
...
//planetary surface
QGLMaterial *mat2 = new QGLMaterial;
url.setPath(QLatin1String(":/planet.jpg"));
url.setScheme(QLatin1String("file"));
mat2->setTextureUrl(url);
m_LoadedTextures.push_back(mat2->texture());
int planetMat = root->palette()->addMaterial(mat2);
...
// create the planet
builder.newNode()->setObjectName(QLatin1String("Planet"));
builder<<QGLSphere(0.4);
builder.currentNode()->setMaterialIndex(planetMat);
builder.currentNode()->setEffect(QGL::LitModulateTexture2D);
...
return builder.finalizedSceneNode();


but I can not overlay texture on the part this sphere with any coordinates.
For example, like this
8341

I want get random coordinates and overlay there random square texture (not to the whole sphere).
Сan anyone show an example how to do it?
thanks in advance=)