opengl windows bugged placement on compositing
Roland Plüss
roland at rptd.ch
Wed Jan 8 03:20:24 PST 2014
On 01/08/2014 04:50 AM, Thomas Lübking wrote:
> On Mittwoch, 8. Januar 2014 01:14:20 CEST, Roland Plüss wrote:
>
>> You have a window with an OpenGL context for 3D rendering.
>> You create the window with XCreateWindow and an OpenGL infused visual
>> (glXChooseVisual).
>> After creating it you reparent the window into your application
>> (XReparentWindow).
>
> Can you show the actual code?
Unfortunately not. But maybe this screenshot might help to better
explain the problem: http://rptd.ch/misc/debug/composite_gl_problem.jpg
. the red rectangle is the location of the window as reported by
xwininfo. OpenGL though renders quite somewhere else in a broken way. In
general I did really nothing more than this:
====== C++ ==========
int attrList[] = {
GLX_RGBA,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_ALPHA_SIZE, 1,
GLX_DEPTH_SIZE, 16,
GLX_STENCIL_SIZE, 16,
GLX_DOUBLEBUFFER,
None };
pVisInfo = glXChooseVisual( display, screen, attrList );
pContext = glXCreateNewContext( display, pBestFBConfig, GLX_RGBA_TYPE,
NULL, True );
/* debug output
II [OpenGL] Visual Infos:
II [OpenGL] Red Bit Count: 8
II [OpenGL] Green Bit Count: 8
II [OpenGL] Blue Bit Count: 8
II [OpenGL] Alpha Bit Count: 8
II [OpenGL] Depth Bit Count: 24
II [OpenGL] Stencil Bit Count: 8
II [OpenGL] Accumulation Buffer Red Bit Count: 0
II [OpenGL] Accumulation Buffer Green Bit Count: 0
II [OpenGL] Accumulation Buffer Blue Bit Count: 0
II [OpenGL] Accumulation Buffer Alpha Bit Count: 0
II [OpenGL] glXChooseFBConfig:
II [OpenGL] Red Bit Count: 8
II [OpenGL] Green Bit Count: 8
II [OpenGL] Blue Bit Count: 8
II [OpenGL] Alpha Bit Count: 8
II [OpenGL] Depth Bit Count: 24
II [OpenGL] Stencil Bit Count: 8
*/
colMap = XCreateColormap( display, rootWindow, pVisInfo->visual,
AllocNone );
swa.colormap = colMap;
swa.border_pixel = 0;
swa.event_mask = BASIC_EVENT_MASK; //0; //pOSUnix->GetEventMask();
swa.do_not_propagate_mask = NOT_PROPAGATE_MASK; //0;
swa.override_redirect = False;
swa.save_under = False;
swa.cursor = 0;
swa.bit_gravity = ForgetGravity;
swa.win_gravity = NorthWestGravity;
pWindow = XCreateWindow( display, parentWindow, 0, 0, width, height, 0,
pVisInfo->depth, InputOutput, pVisInfo->visual, WSA_MASK, &swa );
====== END ==========
The window is create right after the plug window is created with
whatever toolkit I don't know (the NPAPI docs claim Xt or Gtk but I'm
not sure which one is true). I don't think an event loop run manages to
be run in between the too but to my understanding of X this should not
be the problem to begin with.
> Are you using a toolkit?
FOX-ToolKit and NPAPI. With FOX I need resize spaming to get it working
the first time the window is shown. With NPAPI I couldn't get it
working. Docs claim Xt or Gtk.
>
>
>> It seems X11 with compositing in particular reacts very badly to
>> reparenting windows after they have been created.
>
> Check the depth of each window before reparenting them.
> Do they differ (32bit/24bit)?
Both windows are 24-bit. Here the xwininfo of the two (top plug window,
below opengl window):
xwininfo: Window id: 0x5600001 (has no name)
Absolute upper-left X: 8
Absolute upper-left Y: 112
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 1024
Height: 786
Depth: 24
Visual: 0x23
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +8+112 -648+112 -648-152 +8-152
-geometry 1024x786+0+0
xwininfo: Window id: 0x5600005 ""
Absolute upper-left X: 8
Absolute upper-left Y: 112
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 1024
Height: 786
Depth: 24
Visual: 0x27
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x5600004 (not installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +8+112 -648+112 -648-152 +8-152
-geometry 1024x786+0+0
>
> Cheers,
> Thomas
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s
--
Mit freundlichen Grüssen
Plüss Roland
Leader und Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- Sowie verschiedene Blender Export-Skripts und Game-Tools
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20140108/21e6629f/attachment.pgp>
More information about the xorg
mailing list