John Hoare wrote:
> Perhaps If I give you an example of how my library is used, you (or
> someone) can give me a better way to achieve this.
>
> Picture* pic = robot.takePicture("color");
> pic->show(); //blocks until image is closed
>
> This code should take a picture from the robot, and then open a display
> window, and display the picture. From my understanding, this should be
> easy: open a window, and then call Fl::run(), which will return once the
> image is closed.
This sounds a lot like a normal dialog where the program
doesn't proceed until the dialog closes, eg:
dialog = new YourPictureDialog();
dialog->takePicture();
dialog->show();
while (dialog->visible()) {
Fl::wait(.10);
}
..this way the program can then do other stuff.
The other way to do this would be to make a separate program
and run it from the main app. Assuming there's little interaction
between the two, this might be reasonable. Then the main app
can choose whether to wait for the separate program to finish,
or continue running doing other things. I'd think that would work
well for realtime video as well. This way you can give that separate
process higher priority for realtime playback (if needed).
You can probably do it with threads too, where the thread
provides the data to a common area that the main thread can
"pixel blit" into the video window. Basically a 15 or 20
ticks-per-second timer can read the common area for new data
and blit it to the screen. Use locking to keep the data safe
from races.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk