Hi all,
Here, I joined a QGLWidget class QGLWidget in a main window. The glwidget displays well what is contained in the method paintGL ().
But I want to ensure that these methods, those contained in paintGL, are called from the mainwindows by the user according to his need to display.
Here are bits of code most relevant to get an idea of the situation:

mainwindow.cpp:
Qt Code:
  1. mainwindow::mainwindow()
  2. {
  3. m_Central= new QWidget;
  4. m_layout = new QGridLayout;
  5. m_Central->setLayout(m_layout);
  6.  
  7. m_carto = new GLWidget
  8. m_carto->displayRedTriangle();
  9. m_layout->addwidget(carto);
  10.  
  11. setCentralWidget(m_Central);
  12. }
To copy to clipboard, switch view to plain text mode 

glwidget.cpp:
Qt Code:
  1. void GLWidget::paintGL()
  2. {
  3. // some initializing boring parameters
  4. // Setting displayRedTriangle() here will show the red triangle in the user interface.
  5. }
  6.  
  7. void GLWidget::displayRedTriangle()
  8. {
  9. glBegin(GL_TRIANGLES)
  10. glColor3f(1.0f,0.0f,0.0f)
  11. glVertex3i(-1,0,2);
  12. glVertex3i(1,0,2);
  13. glVertex3i(0,0,0);
  14. glEnd();
  15. }
To copy to clipboard, switch view to plain text mode 

So the question is, how to use and make work the displayRedTriangle() from any place that is not directly paintGL?
Thanks for your help,
Best regards.

Cyril