JOGL 2
Forum rules
Discuss your feature requests for the next release of Ardor3D here. Please make a ticket and reference it in your first post.
Discuss your feature requests for the next release of Ardor3D here. Please make a ticket and reference it in your first post.
Re: JOGL 2
Hi
Only a very few things are missing to use JInput the same way I already use JOGL, i.e with automatic extraction of native libraries. I still have to implement its support in the renderer based on JOGL 2.0.
The new release candidate of JOGL 2.0 is going to fix Maven support. Ardor3D users who rely on JOGL 2.0 will obviously benefit of it.
@Renanse Someone asked me if I could expose some OpenGL 3 & 4 features that deals with tesselation. Is it ok for you? It won't be possible to backport them as they are not available in JOGL 1.
Only a very few things are missing to use JInput the same way I already use JOGL, i.e with automatic extraction of native libraries. I still have to implement its support in the renderer based on JOGL 2.0.
The new release candidate of JOGL 2.0 is going to fix Maven support. Ardor3D users who rely on JOGL 2.0 will obviously benefit of it.
@Renanse Someone asked me if I could expose some OpenGL 3 & 4 features that deals with tesselation. Is it ok for you? It won't be possible to backport them as they are not available in JOGL 1.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
Hi
The problems occurring with several monitors will be fixed in several weeks or months. As a first step, I wrote a request for enhancement in JogAmp's bug tracker:
https://jogamp.org/bugzilla/show_bug.cgi?id=600
When this feature is implemented in JOGL (NEWT), I will be able to use it in Ardor3D and I will use the primary (1-monitor wide) screen by default. If you wish to use anything else, you will have to select it by yourself but I will provide some examples.
If this behavior is not satisfying, I will try to use the "default" screen whatever it is.
Best regards.
The problems occurring with several monitors will be fixed in several weeks or months. As a first step, I wrote a request for enhancement in JogAmp's bug tracker:
https://jogamp.org/bugzilla/show_bug.cgi?id=600
When this feature is implemented in JOGL (NEWT), I will be able to use it in Ardor3D and I will use the primary (1-monitor wide) screen by default. If you wish to use anything else, you will have to select it by yourself but I will provide some examples.
If this behavior is not satisfying, I will try to use the "default" screen whatever it is.
Best regards.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
Hi,
I just tried out all this with the latest jars. Unfortunately, it didn't work so well. I'm on Windows 7 x64. Before that I used Lwjgl which works fine.
With Jogl2 I first used the JoglCanvas but got this:
Then I wanted to try JoglAwtCanvas and first had to find out what I could use instead of the NativeCanvas methods like isClosing() and close(). I commented out my isClosing() logic and used destroy() for close() at the moment just to make a test. But when I try to access the renderer with canvas.getCanvasRenderer().getRenderer() I just get a NULL back. I need to access it to change the background color. By the way, if it helps, the toString() of the JoglCanvasRenderer from canvas.getCanvasRenderer() is:
And now I wanted to try JoglNewtAwtCanvas but when I want to init the scene, the Camera object is null, i.e. canvas.getCanvasRenderer.getCamera(). The renderer object has these values which don't look right I guess:
Some child object of the Awt window has this toString():
I have no idea what I should look for or what I'm doing wrong.
It would also be good if you could include the source in your jars, otherwise debugging is quite difficult.
Any ideas?
I just tried out all this with the latest jars. Unfortunately, it didn't work so well. I'm on Windows 7 x64. Before that I used Lwjgl which works fine.
With Jogl2 I first used the JoglCanvas but got this:
- Code: Select all
No OpenGL context current on this thread
javax.media.opengl.GLException: No OpenGL context current on this thread
at javax.media.opengl.glu.GLU.getCurrentGL(GLU.java:176)
at com.ardor3d.renderer.jogl.JoglRenderer.setBackgroundColor(JoglRenderer.java:119)
at ....Screenshotter.init(Screenshotter.java:126)
at com.ardor3d.framework.FrameHandler.init(FrameHandler.java:178)
at ....Screenshotter.run(Screenshotter.java:250)
at java.lang.Thread.run(Thread.java:722)
Then I wanted to try JoglAwtCanvas and first had to find out what I could use instead of the NativeCanvas methods like isClosing() and close(). I commented out my isClosing() logic and used destroy() for close() at the moment just to make a test. But when I try to access the renderer with canvas.getCanvasRenderer().getRenderer() I just get a NULL back. I need to access it to change the background color. By the way, if it helps, the toString() of the JoglCanvasRenderer from canvas.getCanvasRenderer() is:
- Code: Select all
AWT-GLCanvas[Realized false,
null-drawable,
Factory null,
handle 0x0,
Drawable size -1x-1,
AWT pos 0/0, size 800x1200,
visible true,
null]
And now I wanted to try JoglNewtAwtCanvas but when I want to init the scene, the Camera object is null, i.e. canvas.getCanvasRenderer.getCamera(). The renderer object has these values which don't look right I guess:
- Code: Select all
JoglCanvasRenderer (id=40)
_camera null
_context null
_currentContext null
_debugEnabled false
_doSwap false
_frameClear 3
_renderer null
_scene Screenshotter (id=31)
_useDebug false
MAX_CONTEXT_GRAB_ATTEMPTS 10
Some child object of the Awt window has this toString():
- Code: Select all
NEWT-GLWindow[
Helper: GLAnimatorControl: null, GLEventListeners num 0 [],
Drawable: null,
Context: null,
Window: jogamp.newt.driver.windows.WindowsWindow[Config null
, NEWT-Screen[Windows_nil-10, idx 0, refCount 0, 0x0, null, NEWT-Display[Windows_nil-1, refCount 0, hasEDT true, edtRunning true, null]]
, ParentWindow null
, ParentWindowHandle 0x0 (false)
, WindowHandle 0x0
, SurfaceHandle 0x0 (lockedExt window false, surface false)
, Pos 64/64 (auto true), size 128x128
, Visible false, focus false
, Undecorated true (true)
, AlwaysOnTop false, Fullscreen false
, WrappedWindow null
, ChildWindows 0, SurfaceUpdatedListeners num 0 [], WindowListeners num 1 [com.jogamp.newt.opengl.GLWindow$1@7bec57ce, ], MouseListeners num 0 [], KeyListeners num 0 [], surfaceLock <5978d4f1, be4481b>[count 0, qsz 0, owner <NULL>], windowLock <3839eab6, 62606f90>[count 0, qsz 0, owner <NULL>]]]
I have no idea what I should look for or what I'm doing wrong.
It would also be good if you could include the source in your jars, otherwise debugging is quite difficult.
Any ideas?
- neothemachine
- regular
- Posts: 88
- Joined: Tue Mar 13, 2012 9:58 am
Re: JOGL 2
Hi
Simply start by using existing examples based on JOGL instead of porting some code from its competitor (just as a first step as you seem to do something not really API agnostic), they work correctly, they just do the right things, they have been tested on all supported platforms. The threading of JOGL is a bit stricter than its competitor, especially in JOGL 2.0 but if you respect it, you will get the most reliable solution. Keep in mind that some platforms and some drivers might be more tolerant; if you aren't strict enough, your applications will only work with them. You use JoglCanvas but you perform an operation requiring the OpenGL context whereas it is not yet current on this thread, maybe even on the wrong thread or too early, that's why you get a null canvas renderer too. It would be safer to do such things once in a drawing method or just put your task into the queue so that they are done at the appropriate moment.
Simply start by using existing examples based on JOGL instead of porting some code from its competitor (just as a first step as you seem to do something not really API agnostic), they work correctly, they just do the right things, they have been tested on all supported platforms. The threading of JOGL is a bit stricter than its competitor, especially in JOGL 2.0 but if you respect it, you will get the most reliable solution. Keep in mind that some platforms and some drivers might be more tolerant; if you aren't strict enough, your applications will only work with them. You use JoglCanvas but you perform an operation requiring the OpenGL context whereas it is not yet current on this thread, maybe even on the wrong thread or too early, that's why you get a null canvas renderer too. It would be safer to do such things once in a drawing method or just put your task into the queue so that they are done at the appropriate moment.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
Hi
I will update Maven pom file soon. Please follow these indications if you need to use it immediately:
https://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Maven
It doesn't support JOAL and JOCL yet.
As for "JInput For JogAmp", I still wait for the implementation of the automatic extraction and loading of native libraries from JARs but when it is done, I will need a very little time to use it in Ardor3D.
I will update Maven pom file soon. Please follow these indications if you need to use it immediately:
https://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Maven
It doesn't support JOAL and JOCL yet.
As for "JInput For JogAmp", I still wait for the implementation of the automatic extraction and loading of native libraries from JARs but when it is done, I will need a very little time to use it in Ardor3D.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
I'm sorry but I need some more help... I wanted to try the jogl-demos project and also checked out gluegen and jogl as projects so that I could in theory build them with the Ant script. That didn't work. The gluegen build failed with
Which seems rather odd. By the way, I hate Ant :p
Is there any other source for small JOGL 2 tutorials or examples?
- Code: Select all
gluegen.build.c.impl:
[javah] Exception in thread "main" java.lang.NullPointerException
[javah] at com.sun.tools.javah.JavahTask.run(JavahTask.java:509)
[javah] at com.sun.tools.javah.JavahTask.run(JavahTask.java:335)
[javah] at com.sun.tools.javah.Main.main(Main.java:46)
Which seems rather odd. By the way, I hate Ant :p
Is there any other source for small JOGL 2 tutorials or examples?
- neothemachine
- regular
- Posts: 88
- Joined: Tue Mar 13, 2012 9:58 am
Re: JOGL 2
Have you looked at this?
http://jogamp.org/jogl/doc/HowToBuild.html
http://jogamp.org/wiki/index.php/Jogl_Tutorial
Actually, I was speaking about the examples in Ardor3D using JOGL 2.0 including JoglAwtExample:
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java
http://jogamp.org/jogl/doc/HowToBuild.html
http://jogamp.org/wiki/index.php/Jogl_Tutorial
Actually, I was speaking about the examples in Ardor3D using JOGL 2.0 including JoglAwtExample:
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/basic/JoglBasicExample.java
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java
http://ardorlabs.trac.cvsdude.com/Ardor3Dv1/browser/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
Hi
If you really need to use the native libraries as separate files, just extract them from the JARs. You will need to do that to use this renderer in an OSGI bundle, in an Eclipse fragment or in a Netbeans module.
If you really need to use the native libraries as separate files, just extract them from the JARs. You will need to do that to use this renderer in an OSGI bundle, in an Eclipse fragment or in a Netbeans module.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: JOGL 2
I tried to use Jogl 2.0 again as I now think that I correctly queue actions and do proper threading (with LwjglCanvas and LwjglAwtCanvas it works).
My experiences:
JoglNewtAwtCanvas -> hangs (window is extremely small, not the size I gave it)
JoglAwtCanvas -> works
JoglCanvas -> Exception (which is strange as I thought it's just a convenient wrapper for JoglAwtCanvas):
Also, when using AWT (both Lwjgl and Jogl) I can't get the background to be transparent. It's black outside the mesh (mesh is correctly partly transparent when taking screenshot). I already tried setBackground(new Color(0, 0, 0, 0)) on the JFrame and the canvas, and also canvas.getCanvasRenderer().getRenderer().setBackgroundColor(new ColorRGBA(0, 0, 0, 0)).
My experiences:
JoglNewtAwtCanvas -> hangs (window is extremely small, not the size I gave it)
JoglAwtCanvas -> works
JoglCanvas -> Exception (which is strange as I thought it's just a convenient wrapper for JoglAwtCanvas):
- Code: Select all
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Waited 5000ms for: <6482d603, 49b09282>[count 1, qsz 0, owner <main>] - <AWT-EventQueue-0>
at jogamp.common.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:206)
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
at javax.media.opengl.Threading.invoke(Threading.java:191)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:405)
at jogamp.opengl.GLDrawableHelper.invoke(GLDrawableHelper.java:287)
at javax.media.opengl.awt.GLCanvas.invoke(GLCanvas.java:659)
at com.ardor3d.framework.jogl.JoglAwtCanvas.draw(JoglAwtCanvas.java:96)
at com.ardor3d.framework.jogl.JoglCanvas.draw(JoglCanvas.java:236)
at ....ScreenshotterJogl.run(ScreenshotterJogl.java:254)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.RuntimeException: Waited 5000ms for: <6482d603, 49b09282>[count 1, qsz 0, owner <main>] - <AWT-EventQueue-0>
at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:182)
at com.jogamp.nativewindow.awt.JAWTWindow.lockSurface(JAWTWindow.java:271)
at jogamp.opengl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:195)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:372)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:415)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:364)
at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:868)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
at java.awt.EventQueue.access$000(EventQueue.java:96)
at java.awt.EventQueue$1.run(EventQueue.java:608)
at java.awt.EventQueue$1.run(EventQueue.java:606)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Also, when using AWT (both Lwjgl and Jogl) I can't get the background to be transparent. It's black outside the mesh (mesh is correctly partly transparent when taking screenshot). I already tried setBackground(new Color(0, 0, 0, 0)) on the JFrame and the canvas, and also canvas.getCanvasRenderer().getRenderer().setBackgroundColor(new ColorRGBA(0, 0, 0, 0)).
- neothemachine
- regular
- Posts: 88
- Joined: Tue Mar 13, 2012 9:58 am
Re: JOGL 2
Hi
The fact that it works with the competitor of JOGL does not mean that your threading is proper but I know it is difficult to understand because Ardor3D is less high level than JMonkeyEngine, there is no equivalent of com.jmex.game.StandardGame in Ardor3D. I cannot tell you what is wrong, I don't even know if your project is open source, I cannot reproduce your problem on examples.
The background color is just used as a clear color (see glClearColor), it does not drive your background transparent. If you want to make a transparent Ardor3D widget, you need to use a Swing non opaque component as a container (JInternalFrame, JPanel, etc) and to add JoglAwtCanvas into it. I succeeded in doing something similar in plain JOGL without Ardor3D, maybe I'm missing something.
The fact that it works with the competitor of JOGL does not mean that your threading is proper but I know it is difficult to understand because Ardor3D is less high level than JMonkeyEngine, there is no equivalent of com.jmex.game.StandardGame in Ardor3D. I cannot tell you what is wrong, I don't even know if your project is open source, I cannot reproduce your problem on examples.
The background color is just used as a clear color (see glClearColor), it does not drive your background transparent. If you want to make a transparent Ardor3D widget, you need to use a Swing non opaque component as a container (JInternalFrame, JPanel, etc) and to add JoglAwtCanvas into it. I succeeded in doing something similar in plain JOGL without Ardor3D, maybe I'm missing something.
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Who is online
Users browsing this forum: No registered users and 0 guests