Login  Register

Re: Centering a Newt window?

Posted by Sven Gothel on Oct 16, 2012; 11:11am
URL: https://forum.jogamp.org/Centering-a-Newt-window-tp4026458p4026510.html

On 10/16/2012 11:16 AM, adi [via jogamp] wrote:
> Thanks.
>
> Do you mean that ??:
>
> Display myDisplay =
> NewtFactory.createDisplay(NativeWindowFactory.TYPE_DEFAULT, "MySreen");
> int undefined = myDisplay.addReference();
> Screen myScreen = NewtFactory.createScreen(myDisplay, undefined );

addReference() returns the ref-count .., see following code-snippet:

final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null);
final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0);
scrn.addReference(); // gain ref-count 0 -> 1, which actually creates native resource

// now you can query details
// like int width = scrn.* whatever ..
             
final GLWindow win = GLWindow.create(scrn, new GLCapabilities(null));
win.setSize(width,height);
win.setVisible(true);
scrn.removeReference(); // release count 2 -> 1

...

win.destroy(); // will also destroy scrn ..

+++

Note: You can use your IDE (eclipse, ..)
and open the JOGL project, go to Screen.addReference()
and click: 'Open Call Hierarchy'
This will show you a list of callers .. and hence examples.

~Sven


signature.asc (907 bytes) Download Attachment