Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

[SOLVED] How to force QGLWidget to update screen?

$
0
0
I’m drawing a simple scene with Open GL. I’ve subclassed QGLWidget and overriden paintGL(). Nothing fancy there: void CGLWidget::paintGL()  {     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);     glClear(GL_COLOR_BUFFER_BIT);       glMatrixMode(GL_MODELVIEW);     glLoadIdentity();       gluLookAt (120.0, 160.0, -300.0, 0.0 + 120.0, 0.0 + 160.0, 2.0 - 300.0, 0.0, 1.0, 0.0);     glScalef(1.0f/300.0f, 1.0f/300.0f, 1.0f/300.0f);     glClear(GL_DEPTH_BUFFER_BIT);       glMatrixMode(GL_PROJECTION);     glLoadIdentity();     gluPerspective(80.0, width()/(double)height(), 5.0, 100000.0);     glMatrixMode(GL_MODELVIEW);       glBegin(GL_POINTS);     glColor3f(1.0f,0.6f,0.0f);     glVertex3d(x, y, z);     // ...drawing some more points...     glEnd();  } I have a timer in main window which triggers updateGL() of GL widget. I’ve verified that it results in paintGL() being called. However, the actual picture on the screen is only updated very rarely. Even if I resize the window, scene is not updated. Why is that and how can I force it to update?

Viewing all articles
Browse latest Browse all 18427

Latest Images

Trending Articles



Latest Images