Bart Krekelberg wrote:
> I have an application that needs to draw the same (moving) image to two 
> separate OpenGL windows.
> 
> I cannot call the drawing code itself twice; because it would take too long, 
> but also because that code has side effects that should not happen twice.
> 
> The solution would seem to be to create an OpenGL Display list,
> make the normal window current , execute the display list, then make the 
> other window (called 'mirror') current and execute it again. This worked in a 
> GLUT-based version of my application but not in FLTK.

        In fltk there's only one time you can draw into a window,
        from that window's draw() method.

        So don't try to draw into a window outside of that
        window's draw() method. This would include using one
        window's draw() method to draw into the other.

        To trigger the draws, I'd recommend using a timer running
        at the frame rate you want to update the drawlist, and then
        tell fltk to schedule both windows to redraw themselves by
        calling redraw() for both windows:

// YOUR TIMER'S CALLBACK
YourTimer_CB(void*) {
    UpdateDisplayList();
    window->redraw();
    mirror->redraw();
}

        When your callback returns, FLTK will handle invoking
        the draw() methods for the two windows, which can then
        both access the mainDisplayList.
_______________________________________________
fltk-opengl mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-opengl

Reply via email to