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:
    But how to color a single builder object? WI use the following code.

    @QGLBuilder builder;
    builder << QGL::Faceted;
    builder << QGLCube();
    QGLMaterial *cubematerial= new QGLMaterial;
    cube = builder.finalizedSceneNode();@

    It gives me an error:
    :57: error: no matching function for call to 'QGLBuilder::palette(QGLMaterial*&)'
    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));
    painter->setFaceColor(QGL::AllFaces, QColor(200, 202, 0));

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.