[XForms] Patch: GLCanvas context sharing support.

jason cipriani jac4 at mindless.com
Fri May 14 11:45:41 EDT 2004


The patch needs a bit of work anyway, I shouldn't have submitted it without testing it. Primary issue being the fact that it needs a GLXContext to share with, which isn't created until the canvas is about to be shown, so it will work fine if you created a shared canvas after the form is shown but that doesn't lend itself well to fdesign. I have another method that works just fine but I have a question about this part of glx_init() in glcanvas.c:
 
     /* under some conditions, the parent of the gl canvas might go away,
        leaving the old context and vi hanging. */
     glx_cleanup(ob);
 
What conditions are "some conditions"?
 
What I am doing now is keeping the FL_OBJECT* for the glcanvas you want to share a context with in the glcanvas's CSPEC. Then, in glx_init(), it checks to see if that glcanvas has a GLXContext yet. If it doesn't, then it forces initialization of that canvas. That's fine but what that means is that if "some conditions" are true and also if the shared canvas is created -before- the canvas it's sharing context data with, then the shared canvas's glx_init() won't attempt to initialize the canvas its sharing data with (since it's GLXContext isn't 0), so it will use it's GLXContext. But then when the canvas its sharing data with is initialized (and some conditions are true), then its context will be destroyed and a new one will be creating, invalidating the GLXContext that the shared canvas is sharing data with.
 
So I need to figure out a way to ensure that the canvas its sharing data with is properly initialized first, rather than it just having some leftover old GLXContext associated with it because "the parent of the gl canvas [went] away".
 
As far as the GL stuff, the problem was that this was removed from forms.h in 1.0.90 (it was there in 1.0):
 
#if defined(__GLX_glx_h__) || defined(GLX_H)
#include <X11/glcanvas.h>
#endif

Simple solution was to add it back in, rather than #include'ing glcanvas.h in all the xforms apps we have.

Jason


----- Original Message -----
From: Angus Leeming <angus.leeming at btopenworld.com>
Date: Fri, 14 May 2004 09:30:05 +0100
To: xforms <xforms at bob.usuhs.mil>
Subject: Re: [XForms] Patch: GLCanvas context sharing support.

> On Thursday 13 May 2004 11:21 pm, jason cipriani wrote:
> > This patch allows support for context sharing in GLCanvases, a
> > feature which should have been in there long, long ago. Not tested
> > because something about 1.0.90 seems to have broken the GLCanvas
> > stuff entirely (as in, none of the GLCanvas functions are in
> > forms.h any more). So I'll have to get to the bottom of that first.
> > In the mean time, here is the patch (glcanvas.c/glcanvas.h), if
> > anybody has a version of 1.0.90 with working GLCanvases.
> 
> Jason, all the GL stuff was moved into its own directory/libraryheader 
> file for the 1.0 release. Find it in the gl directory.
> 
> 'make install' will lead to these files being installed:
> 
> fd2ps fdesign
> flimage.h  forms.h  glcanvas.h
> libflimage.a  libforms.a  libformsGL.a
> libflimage.so  libforms.so  libformsGL.so
> 
> Angus
> 
> 

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the Xforms mailing list