Hi all this is my first post here. I am writing a program and would like some advice about how to structure it.
Here is the deal: the program takes image data from a PCI card and then displays it in an OpenGL window. I am using the Qt libraries for my GUI and when I am in the process of taking the data, converting it to what OpenGL needs, and then displaying it, the GUI hangs. I realize I need a separate thread for this.
The problem I have with this is that I also have to have a contrast slider and I have no idea where to put that. The idea is that when someone adjusts the slider, the look-up table for the image values gets update and the image is re-rendered.
How do I have this operation happen without any conflicts from the separate thread? For example, what if I try to adjust the contrast right as the image is already being rendered by the other thread? This data will come in at around 30fps, so the likelihood of this happening is pretty high.
My solution at the moment would be to only have the thread take the data and run it through the look-up table, give the signal that it is done to the main thread, and then have the main thread just render the image onto the screen. I don't know if that would work, though. I don't want to get any sort of stuttering in the GUI because the rendering happens in the main thread.
Any help would be appreciated.