Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Adding color to QGLBuilder object

    Game Development
    1
    2
    685
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sunil.nair last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • S
        sunil.nair last edited by

        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);@

        1 Reply Last reply Reply Quote 0
        • First post
          Last post