Exemplo n.º 1
0
void PrimitiveRenderer::drawPoint(float x1, float y1, GLColor *color)
{
  //NOTE, coords are normalized, gotta deal with that
  GLfloat vertices[] = {
    x1, y1
  };
  OpenGLManager::bindVAO(this->pointVAO);
  OpenGLManager::bindVBO(this->pointVBO);
  this->pointShader.use();

  //glBufferSubData(GL_ARRAY_BUFFER, NULL, sizeof(vertices), &vertices[0]);
  OpenGLManager::bufferSubData(GL_ARRAY_BUFFER, NULL, sizeof(vertices), &vertices[0]);

  if (color != nullptr)
    {
      glm::vec4 assignedColor(color->r, color->g, color->b, color->a);
      this->pointShader.setVector4f("pointColor", assignedColor);
    }
  else
    {
      glm::vec4 defColor(defaultColor.r, defaultColor.g, defaultColor.b, defaultColor.a);
      this->pointShader.setVector4f("pointColor", defColor);
    }

  //glDrawArrays(GL_POINTS, 0, 2);
  OpenGLManager::drawArrays(GL_POINTS, 0, 2);

  OpenGLManager::unbindVAO();
  OpenGLManager::unbindVBO();
  this->pointShader.unbind();
}
void DeclarativeSettingsPageImpl::addColorField(const QString &key, const DeclarativeSettingsPage::Entry &entry)
{
    QToolButton * control = new QToolButton(pClass_);
    QColor defColor(Qt::black);
    if (entry.defaultValue.isValid()) {
        defColor = QColor(entry.defaultValue.toString());
    }
    setButtonColor(control, defColor);
    connect(control, SIGNAL(clicked()), this, SLOT(showColorDialog()));
    widgets_[key] = control;
    addField(entry.title, control);
}