Thats right, all painting must be done from painGL method, but you can call other drawing methods from paintGL. Simple example, you can have a boolean values to control what to draw, like this:
void MyGlWidget::paintGL(){
if( this->_drawPolygon ){ // boolean value to control visibility of a polygon
this->drawPolygon();
}
if( this->_drawTexture1 ){ // same for visibility of a texture
this->drawTexture1();
}
if( this->_drawSomethingElse ) ...
}
// some methods to control what should be rendered
void MyGlWidget::setDrawPolygon( bool draw ){
this->_drawPolygon = draw;
this->updateGL();
}
void MyGlWidget::setDrawTexture1( bool draw ){
this->_drawTexture1 = draw;
this->updateGL();
}
void MyGlWidget::setDrawSomethingElse( ... etc.
void MyGlWidget::paintGL(){
if( this->_drawPolygon ){ // boolean value to control visibility of a polygon
this->drawPolygon();
}
if( this->_drawTexture1 ){ // same for visibility of a texture
this->drawTexture1();
}
if( this->_drawSomethingElse ) ...
}
// some methods to control what should be rendered
void MyGlWidget::setDrawPolygon( bool draw ){
this->_drawPolygon = draw;
this->updateGL();
}
void MyGlWidget::setDrawTexture1( bool draw ){
this->_drawTexture1 = draw;
this->updateGL();
}
void MyGlWidget::setDrawSomethingElse( ... etc.
To copy to clipboard, switch view to plain text mode
Bookmarks