Adding color to QGLBuilder object
-
I am learning QT. I can successfully add multiple nodes to my scene. I want to give a color to each of the builder objects. I can add color to the whole node using:
painter->setStandardEffect(QGL::LitMaterial);
But how to color a single builder object? WI use the following code.@QGLBuilder builder;
builder << QGL::Faceted;
builder << QGLCube();
QGLMaterial *cubematerial= new QGLMaterial;
cubematerial->setColor(Qt::red);
builder.palette(cubematerial);
cube = builder.finalizedSceneNode();@It gives me an error:
:57: error: no matching function for call to 'QGLBuilder::palette(QGLMaterial*&)'
builder.palette(cubematerial);
^
What does it mean. Also, if I need to change the position of the cube, what should I do? Thanks in advance. -
Hey, i figured it out. You just need to change the painter properties and set it to the new node. @painter->setStandardEffect(QGL::LitMaterial);
painter->setFaceColor(QGL::AllFaces, QColor(170, 202, 0));
cube->draw(painter);
painter->setFaceColor(QGL::AllFaces, QColor(200, 202, 0));
trident->draw(painter);@