why am i getting this strange window when i run my program, instead of what am suppose to get (window filled with red)
why am i getting this strange window when i run my program, instead of what am suppose to get (window filled with red)
That paintGL isn't probably called at all, so you have to tell qt that the widget should be updated. Try calling updateGL.
Your window is showing a chunk of uninitialized memory, so it is showing whatever was there before. I appears you are clearing the screen. Are you swapping the back buffer to the window after you are done drawing?
EDIT: I have never used qt, but it appears that Sponji is referring to the same thing, make sure you present your rendered scene to the window.
class C3dViewWidget : public QGLWidget {
…
protected :
// == Members.
// Update timer.
QTimer m_tTimer;
private slots :
/**
* Called by the timer to update this view.
*/
void Update();
};
void C3dViewWidget::InitWidget() {
connect( &m_tTimer, SIGNAL( timeout() ), this, SLOT( Update() ));
}
void C3dViewWidget::Update() {
this->repaint();
}
You can get a lot more useful help when you actually put some effort into your question.