Login  Register

Re: Simple example with Nifty

Posted by Xerxes Rånby on Nov 08, 2013; 2:48pm
URL: https://forum.jogamp.org/Simple-example-with-Nifty-tp4030529p4030536.html

elect wrote
Xerxes Rånby wrote
There is a NEWT JOGL 2 nifty-gui backend found in the 1.3 nifty gui branch. This branch work on both mobile and desktop devices using the GL2ES2 profile.
https://github.com/void256/nifty-gui/commits/1.3
You mean this one?

https://github.com/void256/nifty-gui/blob/1.4/nifty-examples-jogl/src/main/java/de/lessvoid/nifty/examples/jogl/JOGLNiftyRunner.java

It does be the one I have been starting porting from..

There a GLwindow is used instead of canvas, but isnt canvas compatible too?


Oh kudos for porting the jogl 2 backend it over to the 1.4 branch!



Try avoid using the old GLCanvas since it depend on AWT and this prevent the code to run on new devices such as Android and Raspberry Pi where AWT cant be found or be hardware accelerated.

If you must use AWT/Swing then place the GLWindow inside the Swing or AWT application using a NewtCanvasAWT . This is the only canvas compatible with NEWT.
Try do somehing like:
NewtCanvasAWT newtCanvas = new NewtCanvasAWT(glWindow);
frame.add(newtCanvas);

http://jogamp.org/jogl/doc/NEWT-Overview.html
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/awt/NewtCanvasAWT.html