I have an app that shows (processed) webcam output in an OpenCV window (using imshow) and also, in a different thread, has an OSG window showing some geometry. The problem is that as long as the OSG window is refreshing, the OpenCV window does not update (all the processing in the thread happens, just the call to imshow does nothing). If I drag the OSG window, disabling refreshes, the OpenCV window starts updating normally.
Any ideas why this could happen?
(Windows 8, NVIDIA Quattro K2100, VC++)
You need to call the cv::waitKey()
function inside the OpenSceneGraph viewer loop to have your OpenCV windows update. This means that you cannot simply use the OpenSceneGraph function viewer.run()
. Instead you have to use the following viewer loop:
while (!viewer.done())
{
cv::waitKey(1);
viewer.frame();
}