OpenGL and frame drop
Hi
I’m currently working on an application that have to display pictures very quickly (1/60 s). I need to have 60 fps so I decided to use a QGLWidget and enabled VSync with
- format.setSwapInterval(1);
But currently there are two strange problems.
1. I have on my laptop (Lenovo X200 – Intel X4500 HD) 30FPS instead of 60. I can get 60 FPS with
- format.setSwapInterval(0);
2. More important. I sometimes have “frame drop”. When I need to display a picture for the 1/60s (ie on 1 frame), sometimes it is not displayed at all. Is there any way to force drawing it or at least detect this drop ?
My testing code :
- ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- format.setSwapInterval(0);
- widget->setFormat(format);
- ui->graphicsView->setViewport(widget);
- ui->graphicsView->setScene(m_scene);
- m_subItem->setVisible(false);
- timer->setInterval(0);
- timer->start();
- connect(timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
- }
- MainWindow::~MainWindow()
- {
- delete ui;
- }
- void MainWindow::slotTimeout()
- {
- // Redraw
- m_counter ++;
- m_subItem->setVisible(m_counter % 60 == 0);
- ui->graphicsView->viewport()->update();
- }
0 replies
You must log in to post a reply. Not a member yet? Register here!

