Login  Register

Newt and reparenting preserving the native window handle

Posted by chrix on Mar 12, 2014; 8:21pm
URL: https://forum.jogamp.org/Newt-and-reparenting-preserving-the-native-window-handle-tp4031873.html

I'm using the latest 2.1.5, on Windows 7
I've seen examples showing how to create Newt windows and reparent them to different Frames or canvas'es. But each time the native window handle was actually destroyed then recreated when reparented to a different parent window. Is there a way to use Newt API to create a child window under an AWT frame or canvas and reparent that child window without destroying/recreating the corresponding native window handle?

The Newt page seems to infer so at http://jogamp.org/jogl/doc/NEWT-Overview.html
"Since we use native reparenting, the native window resource keeps alive and hence your OpenGL application (GLEventListener) is not being asked to dispose all resources."

But snippets derived from https://github.com/sgothel/jogl/blob/master/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java or http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java;hb=HEAD showed the native handle was actually destroyed/recreated (e.g. using Spy++).

I thought this was related to https://jogamp.org/bugzilla/show_bug.cgi?id=922 "Unable to preserve resources during NewtCanvasAWT reparenting" but this is fixed.

When I do a reparenting, I always get ACTION_NATIVE_CREATION instead of ACTION_NATIVE_REPARENTING...
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/Window.ReparentOperation.html

Any tip welcome :-)
Chrix