Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Adding color to QGLBuilder object
Forum Update on Monday, May 27th 2025

Adding color to QGLBuilder object

Scheduled Pinned Locked Moved Game Development
2 Posts 1 Posters 841 Views
  • 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 Offline
    S Offline
    sunil.nair
    wrote on 20 Nov 2014, 08:08 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      sunil.nair
      wrote on 20 Nov 2014, 09:34 last edited by
      #2

      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
      0

      2/2

      20 Nov 2014, 09:34

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved