GL canvases

Mike Blackwell (
Thu, 27 Feb 1997 14:15:35 -0500

To subscribers of the xforms list from Mike Blackwell <> :

We have a program which uses several different GL canvases, which
are either shown or hidden depending on the state of the program.
We running in to a performance problem due to the way Xforms
manages the contexts,

The basic problem is that whenever you show a canvas both the
Init and Activate property handlers are called, and whenever
you hide a canvas the Cleanup handler is called.

For GL canvases, the Init handler creates a new GLX context, and
the Cleanup handler destroys that context. Thus, every time you
show a GL canvas you need to completely re-create its context,
which in our case can be a fairly time consuming process (because
we have some large call lists which also need to be re-created).
So the canvas appears, but then there's a delay until something
is drawn waiting for the context to be created.

It seems to me that calling init/cleanup on show/hide is a little
drastic. It would make more sense to call init/cleanup on
create/delete, and activate/deactivate on show/hide, but that
would require a change to the Xforms API.

One work around I've considered is creating a couple of global
contexts maintained by the program, and modifying the init and
cleanup handlers to copy contexts back and forth as necessary.
I haven't tried this yet, and am interested in any comments
on how others may have addressed this problem.

Mike Blackwell
To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: