[XForms] Patch: Context Sharing + fdesign (real thing)

jason cipriani jac4 at mindless.com
Sun May 16 17:57:50 EDT 2004


Ok, here it is. Tested on Mac OS X and Linux-testing coming on Monday. It's a rather large patch. The attached file contains patch.diff, sglcanvas.html (which somewhat 
resembles documentation), and a test program (which isn't worked into the demo folder, and the Makefile might require some tweaking to compile). This patch adds 
support for GLX context sharing in gl canvases, and also gives fdesign the ability to set up canvas sharing via the Spec tab in the glcanvas attribute editor.

Turns out the GLCANVAS_H_LOCATION thing is still inadequate, mostly because if GLCANVAS_H_LOCATION is defined, forms.h includes glcanvas.h. There are some 
functions in glcanvas.h that use the GLXContext type, declared in GL/glx.h. So fdesign generated source files that include forms.h also include glcanvas.h and the 
compiler breaks because GL/glx.h wasn't included in the fdesign source files.

So how about this, it seems to work fine: Instead of GLCANVAS_H_LOCATION, use GLX_H_LOCATION. If GLX_H_LOCATION is defined, then canvas.h can #include both 
GLX_H_LOCATION and <glcanvas.h>. That should fix it. Just compile source with -DGLX_H_LOCATION="<GL/glx.h>" or something, and glcanvas.h is automatically 
included after GL/glx.h is. If you are using gl canvases then indirectly including GL/glx.h from forms.h is not going to hurt anything. If you aren't using gl canvases then 
just don't defined GLX_H_LOCATION and everything remains the same. For now I am #including GL/glx.h directly from glcanvas.h. It's in the patch but I'm not happy with 
it, so remember to take it out if you decide on another way.

You may have to fiddle with the "demo" program Makefile to get it to compile. I didn't work it into /demos.

If anybody wants to try this patch now (it requires Angus' GLCANVAS_H_LOCATION thing too) for some reason:

1) Download fresh copy of xforms-1.0.90, and download attached patch.
2) Before ./configure, head to the xforms-1.0.90 root and do "patch -p1 patch.diff".
3) Build as usual.

Detailed changes (some fdesign files are new):

gl/glcanvas.c
- Added functions to support creation of shared canvases and canvas pools.
gl/glcanvas.h
- #include "GL/glx.h"
- FL_SGLPOOL
- fl_activate_named_sglpool()
- fl_activate_sglpool()
- fl_add_shared_glcanvas()
- fl_create_shared_glcanvas()
- fl_get_glcanvas_sglpool()
- fl_get_max_sglpools()
- fl_get_named_sglpool()
- fl_get_num_sglpools()
- fl_get_sglpool_name()
- fl_set_glcanvas_pool_name()
- fl_set_max_sglpools()
fdesign/Makefile.am
- Compile sp_glcanvas.c.
fdesign/Makefile.in
- Compile sp_glcanvas.c
fdesign/fd_main.h
- Added 'shared' and 'poolname' to SuperSPEC.
fdesign/fd_spec.c
- Added attrib callbacks for FL_GLCANVAS.
- Read "shared" and "poolname" from .fd files into SuperSPEC.
fdesign/fd_spec.h
- Prototypes for sp_glcanvas.c functions.
fdesign/sp_glcanvas.c (new file)
- This file handles spec attributes for FL_GLCANVAS.
- emit_glcanvas_code()
- get_glcanvas_spec_fdform()
- glcanvas_spec_restore()
- save_glcanvas_attrib()
- set_glcanvas_attrib()
fdesign/spec/Makefile.am
- glcanvas_spec.c
- glcanvas_spec.fd
- glcanvas_spec.h
fdesign/spec/Makefile.in
- glcanvas_spec.c
- glcanvas_spec.fd
- glcanvas_spec.h
fdesign/spec/glcanvas_spec.c (new file)
- Source code for glcanvas spec form.
fdesign/spec/glcanvas_spec.fd (new file)
- FD file for glcanvas spec form.
fdesign/spec/glcanvas_spec.h (new file)
- Header for glcanvas spec form.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.tgz
Type: application/octet-stream
Size: 18368 bytes
Desc: not available
Url : attachments/20040516/25fde4c0/attachment-0010.obj 


More information about the Xforms mailing list