void CQTOpenGLUserFunctions::DrawText(const std::string& str_text,
                                       const CVector3& c_center_offset,
                                       const CColor& c_color) {
    glDisable(GL_LIGHTING);
    glDisable(GL_CULL_FACE);
    glColor3ub(c_color.GetRed(),
               c_color.GetGreen(),
               c_color.GetBlue());
    GetOpenGLWidget().renderText(c_center_offset.GetX(),
                                 c_center_offset.GetY(),
                                 c_center_offset.GetZ(),
                                 str_text.c_str());
    glEnable(GL_CULL_FACE);
    glEnable(GL_LIGHTING);
 }
Exemple #2
0
void CBuzzQT::Draw(CBuzzController& c_contr) {
   /* This is the message that will be shown */
   std::string strMsg("R" + ToString(c_contr.GetBuzzVM()->robot));
   /* Append debug message */
   if(c_contr.GetDebugMsg() != "")
      strMsg += ": " + c_contr.GetDebugMsg();
   /* Disable face culling to be sure the text is visible from anywhere */
   glDisable(GL_CULL_FACE);
   /* Disable lighting, so it does not interfere with the chosen text color */
   glDisable(GL_LIGHTING);
   /* Set the text color */
   CColor cColor(CColor::BLACK);
   glColor3ub(cColor.GetRed(), cColor.GetGreen(), cColor.GetBlue());
   /* The position of the text is expressed wrt the reference point of
    * the robot */
   GetOpenGLWidget().renderText(0.0, 0.0, 0.4,   // position
                                strMsg.c_str()); // text
   /* Restore lighting */
   glEnable(GL_LIGHTING);
   /* Restore face culling */
   glEnable(GL_CULL_FACE);
}