Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6374185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:27:24+00:00 2026-05-25T01:27:24+00:00

I have a process that is doing some heavy maths with gl rather than

  • 0

I have a process that is doing some heavy maths with gl rather than the cpu (gl/gpu is so far doing approximatly 100x faster than cpu) but still it is about a minute for usual problem sizes to be ready, so I wanted a nice progress bar to know how long it will take.

So I set up my classes to inherit from QObject and have a signal currentProgress(int) that is emitted every once in a while.
Unfortunately my program freezes during the calculation so no progress is visible.
I found the solution in calling QCoreApplication::processEvents() which gave me another problem.
During this call a repaint of the whole window is triggered which results in my calculation being called in an infinite recursion, because it is itself triggered by the paint event.

Now all this problems are signals that tell my programming intuition slot that I probably misdesigned something, so I ask you what is the default way to have a refreshing progress bar in qt?

Also note: When I want to push the calculation into another thread I probably need to create a new GL context or at least move the existing one over. So if that is the way to go, might someone explain to me how to achieve this in qt?

EDIT

To make things more clear I am not drawing to the QGLWidget but using a FBO.
Probably it is the best to use an own context for the calculations but I don’t know if it is the right way to go.

New Information

So I tried to follow your advice but stumbled upon a problem.
A QGLContext seems to must have been connected to a screen/gui object so I cannot create one offscreen.

Further I cannot make the QGLWidget current in the other threads. It returns the error QGLContext::makeCurrent(): Failed. Further all entries I read about that were people with the same problem like me: They wanted to do renderings in another thread and did not find a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:27:24+00:00Added an answer on May 25, 2026 at 1:27 am

    During this call a repaint of the whole window is triggered which results in my calculation being called in an infinite recursion, because it is itself triggered by the paint event.

    Then you should not be triggering your calculations in the paint event. If the window is the OpenGL window (ie: the GPGPU stuff renders to the window), then you should hide it for the duration of the computations. If it’s not the OpenGL window, then refreshing it should not be provoking the computations.

    Unless you are using OpenGL to actually draw something, you should be using an off-screen render target. Basically, you create a GL window, then create a new context that shares objects with that using WGL_ARB_pbuffers (or the GLX equivalent, depending on your GUI system). This is an off-screen render target. Then you destroy the original window.

    As for threading, don’t forget: even if you have two GL contexts, you only have one GPU. So if you’re using OpenGL to draw to a window, and OpenGL to do some computations, this may not all work out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Javascript heavy Web app, I have some scripts that are loaded in
I have a batch process that imports large amounts of data. I am doing
I have Process objects that are monitored from two different views. A Windows.Forms.ListView (actually
I have 1 process that receives incoming connection from port 1000 in 1 linux
We have a process that needs to run every two hours. It's a process
I have a process that interfaces with a library that launches another process. Occasionally
I have a process that spawns a helper process. Sometimes I need to debug
I have a process that currently runs in a Delphi application that I wrote
I have a process that imports a lot of data (950k rows) using inserts
I have a process that contains C# code, C++\CLI code and native c++ code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.