How to "force" a window into a foreign app?

Roland Plüss roland at rptd.ch
Fri Jun 15 17:07:24 PDT 2007


This is now a little problem that grows larger and larger the longer I
try to fix it. I have the following situation that I can not solve. A
library has the responsibility to render a 3D scene into a windows of a
host app. The host app has no knowledge about how the library renders
the scene nor has the library any idea about what gui-toolkit ( if any )
the host application uses. Hence I have the following:

1) Host application creates a window ( in this case Fox-1.6.27 ).
2) Host application hands the X-Window handle over to the graphic library
3) Graphic library has to render accelerated 3D graphics into this window

So far I simply used the window I received and rendered into it. This
worked so far on two of my machines but now on the third it failed. The
following code fails:
glXMakeCurrent( display, window, context );

The context has been created like this:
config ( ... ) = glXChooseFBConfig(display, screen, attribs,
&configCount); // attribs using typical 3d-rendering attributes
// and chosing the best matching configuration ending up in config.
context = glXCreateNewContext( display, config, GLX_RGBA_TYPE, NULL, True );

So the context there is a good accelerated context usable for rendering
and works well if I create a window on my own ( no host application
around so I create my own window ). Now though on this machine the
window made by FOX uses a non-matching visual and glXMakeCurrent fails.

So I had the idea to create my own window and parent it to the host
window. This so far works but gives some problems like exposing
notification not send ( window only repaints if I explicitly request it,
not if a window is dragged away from it ). Furthermore a ghost window
lingers around in the parent window.

Chances are I did something wrong but I'm lacking any ideas how to fix it.

So assuming the window some application gives me is not matching the
visual I need to work with, how can I manage to still render in this
window or ( if this is not possible ) how can I force my own window into
the host window so it behaves like a real child window? The solution has
to be done using only Xlib as any sort of gui-toolkit could host my library.

-- 
Leader and Head Programmer
- Game: Epsylon (http://epsylon.rptd.ch/)
- Game Engine: Drag(en)gine (http://epsylon.rptd.ch/dragengine.php)
- Normal Map Generator: DENormGen (http://epsylon.rptd.ch/denormgen.php)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20070616/0716c9f6/attachment.pgp>


More information about the xorg mailing list