JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

classic Classic list List threaded Threaded
249 messages Options
1 ... 45678910 ... 13
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
Thanks, I thought so - I began downloading the source from your repository few hours back and I have just managed to compile it on ubuntu. I just used the gdx-backend-jogl target to build. I will try to use this to see whether it works on the Pi.



Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
The project pax-britannica works on the Raspberry Pi like lots of provided LibGDX projects, you can give it a try on your device.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
Pax Britannica works - Just a note for any one looking for the gdx-natives.jar for the raspberryPi, I downloaded the binary from

https://github.com/noxo/libgdx/blob/master/prebuild-raspberry-pi/gdx-natives-arm.jar

Now, I can go on about writing code.

Many thanks to you for your patient replies.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
Hi

krishnak wrote
Pax Britannica works - Just a note for any one looking for the gdx-natives.jar for the raspberryPi, I downloaded the binary from

https://github.com/noxo/libgdx/blob/master/prebuild-raspberry-pi/gdx-natives-arm.jar
Thank you for the feedback and this precious information for other Raspberry Pi users who would like to use LibGDX too.


krishnak wrote
Now, I can go on about writing code.

Many thanks to you for your patient replies.
You're welcome. Don't hesitate to post screen captures of your stuff here and/or on java-gaming.org. Keep in mind that some work has to be done to improve input support on the Pi.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
Have you Managed to get Ardor3d working with JOGL2 - if yes do  I need to build Ardor3d from source to get it working?

libGdx is good, but the examples are sparse and I am not sure whether it supports perspective camera mode?


With reference to Libgdx - when the application PAXBrittanica quits on Ubuntu I get this exception thrown

Exception in thread "main" javax.media.opengl.GLException: main: No OpenGL context current on this thread
        at javax.media.opengl.GLContext.getCurrentGL(GLContext.java:372)
        at com.badlogic.gdx.backends.jogl.JoglGL10.glViewport(JoglGL10.java:430)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.setDisplayMode(JoglGraphics.java:230)
        at de.swagner.paxbritannica.PaxBritannicaDesktop.main(PaxBritannicaDesktop.java:13)
Catched: main-AWTAnimator-1: GLContextImpl.destroy: obj 0x1e808ca, ctx 0x897ac68 - Lock was hold more than twice - makeCurrent/release imbalance: <141fab6, b301f2>[count 4, qsz 0, owner <main-AWTAnimator-1>]
javax.media.opengl.GLException: main-AWTAnimator-1: GLContextImpl.destroy: obj 0x1e808ca, ctx 0x897ac68 - Lock was hold more than twice - makeCurrent/release imbalance: <141fab6, b301f2>[count 4, qsz 0, owner <main-AWTAnimator-1>]
        at jogamp.opengl.GLContextImpl.destroy(GLContextImpl.java:336)
        at jogamp.opengl.GLDrawableHelper.disposeGL(GLDrawableHelper.java:861)
        at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:231)
        at com.jogamp.newt.opengl.GLWindow.access$300(GLWindow.java:94)
        at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.destroyActionInLock(GLWindow.java:433)
        at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:871)
        at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:1570)
        at jogamp.newt.WindowImpl.destroy(WindowImpl.java:928)
        at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:389)
        at com.badlogic.gdx.backends.jogl.JoglApplication$2.run(JoglApplication.java:240)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.display(JoglGraphics.java:118)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:548)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:533)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:904)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:822)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
        at com.badlogic.gdx.backends.jogl.JoglGraphicsBase.requestRendering(JoglGraphicsBase.java:212)
        at com.badlogic.gdx.backends.jogl.JoglApplication.postRunnable(JoglApplication.java:181)
        at com.badlogic.gdx.backends.jogl.JoglApplication.exit(JoglApplication.java:236)
        at de.swagner.paxbritannica.mainmenu.MainMenu.keyDown(MainMenu.java:405)
        at com.badlogic.gdx.backends.jogl.JoglInput.processEvents(JoglInput.java:191)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.display(JoglGraphics.java:124)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:548)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:533)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:904)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:822)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:142)
        at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:175)
        at java.lang.Thread.run(Thread.java:679)
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
krishnak wrote
Have you Managed to get Ardor3d working with JOGL2 - if yes do  I need to build Ardor3d from source to get it working?
Yes of course, the instructions are here. My contributions are frequently merged into the trunk. However, it will probably not work on Raspberry Pi because there is no fully shader-based pipeline in this engine yet, it often uses both the fixed pipeline and the programmable pipeline. You don't need to use my repository to get it except if you need some bug fixes or trendy features (at your own risk) before proper integrations.

krishnak wrote
libGdx is good, but the examples are sparse and I am not sure whether it supports perspective camera mode?
That's explained here.

krishnak wrote
With reference to Libgdx - when the application PAXBrittanica quits on Ubuntu I get this exception thrown

Exception in thread "main" javax.media.opengl.GLException: main: No OpenGL context current on this thread
        at javax.media.opengl.GLContext.getCurrentGL(GLContext.java:372)
        at com.badlogic.gdx.backends.jogl.JoglGL10.glViewport(JoglGL10.java:430)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.setDisplayMode(JoglGraphics.java:230)
        at de.swagner.paxbritannica.PaxBritannicaDesktop.main(PaxBritannicaDesktop.java:13)
Catched: main-AWTAnimator-1: GLContextImpl.destroy: obj 0x1e808ca, ctx 0x897ac68 - Lock was hold more than twice - makeCurrent/release imbalance: <141fab6, b301f2>[count 4, qsz 0, owner <main-AWTAnimator-1>]
javax.media.opengl.GLException: main-AWTAnimator-1: GLContextImpl.destroy: obj 0x1e808ca, ctx 0x897ac68 - Lock was hold more than twice - makeCurrent/release imbalance: <141fab6, b301f2>[count 4, qsz 0, owner <main-AWTAnimator-1>]
        at jogamp.opengl.GLContextImpl.destroy(GLContextImpl.java:336)
        at jogamp.opengl.GLDrawableHelper.disposeGL(GLDrawableHelper.java:861)
        at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:231)
        at com.jogamp.newt.opengl.GLWindow.access$300(GLWindow.java:94)
        at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.destroyActionInLock(GLWindow.java:433)
        at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:871)
        at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:1570)
        at jogamp.newt.WindowImpl.destroy(WindowImpl.java:928)
        at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:389)
        at com.badlogic.gdx.backends.jogl.JoglApplication$2.run(JoglApplication.java:240)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.display(JoglGraphics.java:118)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:548)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:533)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:904)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:822)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
        at com.badlogic.gdx.backends.jogl.JoglGraphicsBase.requestRendering(JoglGraphicsBase.java:212)
        at com.badlogic.gdx.backends.jogl.JoglApplication.postRunnable(JoglApplication.java:181)
        at com.badlogic.gdx.backends.jogl.JoglApplication.exit(JoglApplication.java:236)
        at de.swagner.paxbritannica.mainmenu.MainMenu.keyDown(MainMenu.java:405)
        at com.badlogic.gdx.backends.jogl.JoglInput.processEvents(JoglInput.java:191)
        at com.badlogic.gdx.backends.jogl.JoglGraphics.display(JoglGraphics.java:124)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:548)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:533)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:280)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:904)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:822)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:543)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:142)
        at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:175)
        at java.lang.Thread.run(Thread.java:679)
It means that LibGDX tries to perform an action that requires a current OpenGL context too late when it has already been destroyed. It can be fixed.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
In reply to this post by gouessej
I have got the following message from the developer of Blocky

Start quote

Blocky uses the default settings with Slick Util, which then produces 32-bit (8888) RGBA textures for the GPU. Slick Util can load both 32-bit and 24-bit textures, and produces 32-bit RGBA textures from both, but I have not tried using 24-bit textures on the RaspPi. Slick Util can also produce 16-bit RGB565 textures (by setting a flag), but I have not tried that either.

At the very least I know that 32-bit RGBA is supported by the RaspPi.

end quote

Will this help in identifying the problem with JMonkey rendering
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
Thank you for going on investigating. This information can help you to use the proper texture format. Now I understand one of Noxo's hack that converts BGRA to RGBA to make it work on the Raspberry Pi but I don't understand why it didn't work when you modified TextureUtil.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
In reply to this post by krishnak
This hack should solve your problem.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
Thanks for following up this,  however my TextureUtil.java already has the same code.

I have added some debug statement to check whether the conversion method is called.

I can say that the conversion is called because I get the image format as ABGR8 inside the uploadTexture method call.

Inside TextureUtil.java -> UploadTexture  there is a nested if else block, in that when I run the code on a PC as well on RaspberryPi, the last else block is executed

i.e
else {

                     System.out.println("Inside fifth else");
                            gl.glTexImage2D(target,
                                              i,
                                              glFmt.internalFormat,
                                              mipWidth,
                                              mipHeight,
                                              border,
                                              glFmt.format,
                                              glFmt.dataType,
                                              data);

}

On the PC, the graphics appears.

On the PI, the black window appears, then the JMonkey debug screen which shows the vertices, Triangle, Objects, frame rate etc appears. But no graphics.

The only extra WARNING message that appears on the Raspberry Pi is this

Feb 26, 2013 1:07:33 PM com.jme3.renderer.jogl.JoglRenderer initialize
WARNING: Failed parsing GLSL version assuming it's v1.00

I added a debug statement in the JOGLRenderer.java

On the PC the GLSL version comes back as 120

However on the RaspberryPi, the GLSL version string is coming back as OpenGL - this defaults it to version 100.

I have just modified the code to default to 120 to see whether it makes any difference (I am just blindly coding with out any logic :))

Even with a default value of 120. I only get the black screen and the  console of JMonkey - the objects do not appear. The console shows value for objects etc which match the value when I run the program on a PC.

SIGNIFICANT DIFFERENCE:

On RaspberryPi, if the GLSL version is assumed as 100 - the program hangs after it has been started, i.e a control c will not bring back the prompt, I had to do a CTRL ALT DEL to reboot.

However when I modified the default GLSL version to be 120 - the program no longer hangs, it responds to CTRL C and quits.


Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
In reply to this post by gouessej
Did Noxo use a different renderer to get his code working on the Pi, because earlier today I downloaded his code base had these files

JoglGL1Renderer.java    JoglRenderer.java     TextureUtil.java
JoglRendererGLES2.java  TextureUtilGLES.java  WrappedJoglRenderer.java

Now it only has 3 in the folder
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
This post was updated on .
Noxo used his unified renderer which is extremely close to the code of the official trunk as I integrated most of his fixes except 2 including the RGBA hack. The parsing of GLSL always fails on the Raspberry Pi but on his device, using "100" worked.

Edit.: Moreover, if several drivers for the Raspberry Pi are unable to return the supported GLSL version(s) and if they really support different ones, it will be impossible to provide a satisfying fix without fixing this bug in the driver itself. I can integrate the 2 remaining bug fixes but if they aren't enough, I will have no other solution to suggest.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

dardzull@yahoo.com
In reply to this post by krishnak
I've been using @noxo 's unified renderer (https://github.com/noxo/jmonkey-engine-jogl-gles/tree/unified_renderer) for over a month now, and its working just fine.  Even managed to get the JME3 to render a movie using VLCJ (had to drop sound and a few other tweaks to improve performance).

The things I've learned so far, is that the Pi is a finicky little sucker.  To over come the texture issue I started using the latest Gimp and saving my textures to PNG (not selecting save background color for transparency items) -- they finally started supporting 32bit images which i think is one of the walls I hit right off (jpg was tossing the bgr error at me).  The other wall was when I was fighting the texture size -- the Pi only wanted to use textures that were 8x8, 16x16, 32x32, etc. (used up to 2048x2048 so far).

If you can post a jme3 test case with a sample texture I can see what could be a possible issue your are having.  And assist from there.


Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
I have mailed you my e-mail address so that you can send me a sample texture. I am attaching the image here,  it is just a RGBA image blue colour

Even with image created with the new Gimp (2.6.12) , I am getting the same error.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
In reply to this post by dardzull@yahoo.com
Thank you for your help Dardzull. When I finish integrating the remaining fixes, you'll be able to switch to the official version which is actively maintained.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
In reply to this post by dardzull@yahoo.com
I have integrated the 2 remaining fixes. I have to update the JogAmp version used by JMonkeyEngine 3 too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

krishnak
This post was updated on .
In reply to this post by dardzull@yahoo.com
Dardzull has helped me to get the JMonkeycode working on the Pi - the working snippet is as below

                  wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");; -- this doesn't seem to work

    changed to  >>>  wall_mat = new Material((MaterialDef) assetManager.loadAsset(new AssetKey("Common/MatDefs/Misc/Unshaded.j3md")));
        wall_mat.setTexture("ColorMap", assetManager.loadTexture(new TextureKey("Textures/blue.png", false)));
        wall_mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);  <<< I didn't have this line before
        wall_mat.setColor("Color", ColorRGBA.Blue);

However I have another issue which is minor as of now

When I quit the application - currently using CTRL C - there is a error message from AL Library - ALC (2) Devices not closed and then it hangs there - i.e I am not able to get to the prompt. I have to change to another terminal to log in again and reboot (re-running the code after this error message doesn't run the code.

I get this error both with my code as well as  with Pax Britannica - in case of Pax Britannica the error appears but the code quits and I get the prompt. But I am unable to start the same app with out restarting.

I run the code with out starting X.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
I will update the JogAmp version used by default by JMonkeyEngine, you will have to set a flag to use hardware OpenAL and it should work if you use the official version of JMonkeyEngine of course.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

gouessej
Administrator
In reply to this post by krishnak
You can use the official version on the Pi, I have just updated the JARs (and added the native JARs for ARM v6 hf & sf) and fixed some compile errors. Please use the Ant target "-post-jar" so that the JARs are copied into /opt, then JMonkeyEngine 3 will work very well as expected.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX

Xerxes Rånby
In reply to this post by krishnak
krishnak wrote
...
However I have another issue which is minor as of now

When I quit the application - currently using CTRL C - there is a error message from AL Library - ALC (2) Devices not closed and then it hangs there - i.e I am not able to get to the prompt. I have to change to another terminal to log in again and reboot (re-running the code after this error message doesn't run the code.

I get this error both with my code as well as  with Pax Britannica - in case of Pax Britannica the error appears but the code quits and I get the prompt. But I am unable to start the same app with out restarting.

I run the code with out starting X.
I will try investigate the root cause of this JOAL stall at exit. Its pretty serve, the only way a Linux process can get stuck this hard is if the process is stuck waiting for a function to return, a possible deadlock/livelock, inside the Linux kernel. To me this sounds like a Rasberry Pi audio driver bug.
It needs debugging.

Do you use the Rasbian armhf or the Debian armel distribution?
Which Linux kernel version do you use on the Raspberry Pi?
1 ... 45678910 ... 13