LibGDX on Raspberry Pi using JOGL - error on run -


i'm trying run libgdx desktop app (a simple app displaying image , nothing else) on raspberry pi 2 using jogl backend (https://github.com/gouessej/libgdx/).

in current libgdx version, joglapplicationconfiguration abstract , there 2 child classes: joglawtapplicationconfiguration , joglnewtapplicationconfiguration.

when i'm trying use joglawtapplicationconfiguration run it, i'm getting error:

 [java] glgeterror 0x500  [java] glgeterror 0x500  [java] joglapplication: couldn't initialize audio, disabling audio  [java] java.lang.exceptionininitializererror  [java]     @ com.badlogic.gdx.backends.jogamp.joglapplicationbase.<init>(joglapplicationbase.java:54)  [java]     @ com.badlogic.gdx.backends.jogamp.joglnewtapplication.<init>(joglnewtapplication.java:49)  [java]     @ com.mygdx.game.desktop.desktoplauncher.main(desktoplauncher.java:14)  [java] caused by: com.jogamp.openal.alexception: error opening default openal device  [java]     @ com.jogamp.openal.util.alut.alutinit(alut.java:69)  [java]     @ com.badlogic.gdx.backends.jogamp.audio.openalaudio.<clinit>(openalaudio.java:41)  [java]     ... 3 more  [java] al lib: (ee) alcplaybackoss_open: not open /dev/dsp: nie ma takiego pliku ani katalogu  [java] glgeterror 0x500  [java] exception in thread "main-animator#00" com.jogamp.opengl.util.animatorbase$uncaughtanimatorexception: com.jogamp.opengl.glexception: caught nosuchfielderror: gl on thread main-animator#00  [java]     @ com.jogamp.opengl.util.defaultanimatorimpl.display(defaultanimatorimpl.java:61)  [java]     @ com.jogamp.opengl.util.animatorbase.display(animatorbase.java:451)  [java]     @ com.jogamp.opengl.util.animator$mainloop.run(animator.java:198)  [java]     @ java.lang.thread.run(thread.java:724)  [java] caused by: com.jogamp.opengl.glexception: caught nosuchfielderror: gl on thread main-animator#00  [java]     @ com.jogamp.opengl.glexception.newglexception(glexception.java:76)  [java]     @ jogamp.opengl.gldrawablehelper.invokeglimpl(gldrawablehelper.java:1311)  [java]     @ jogamp.opengl.gldrawablehelper.invokegl(gldrawablehelper.java:1131)  [java]     @ com.jogamp.newt.opengl.glwindow.display(glwindow.java:680)  [java]     @ com.jogamp.opengl.util.defaultanimatorimpl.display(defaultanimatorimpl.java:54)  [java]     ... 3 more  [java] caused by: java.lang.nosuchfielderror: gl  [java]     @ com.mygdx.game.mygdxgame.render(mygdxgame.java:21)  [java]     @ com.badlogic.gdx.backends.jogamp.joglgraphicsbase.display(joglgraphicsbase.java:164)  [java]     @ jogamp.opengl.gldrawablehelper.displayimpl(gldrawablehelper.java:691)  [java]     @ jogamp.opengl.gldrawablehelper.display(gldrawablehelper.java:673)  [java]     @ jogamp.opengl.glautodrawablebase$2.run(glautodrawablebase.java:442)  [java]     @ jogamp.opengl.gldrawablehelper.invokeglimpl(gldrawablehelper.java:1277)  [java]     ... 6 more  [java] egldisplayutil.egldisplays: shutdown (open: 1)  [java] egldisplayutil: open egl display connections: 1  [java] egldisplayutil: open[0]: 0x1: egldisplayref[0x1: refcnt 2] 

while using joglnewtapplicationconfiguration other error:

 [java] glgeterror 0x500  [java] glgeterror 0x500  [java] joglapplication: couldn't initialize audio, disabling audio  [java] java.lang.exceptionininitializererror  [java]     @ com.badlogic.gdx.backends.jogamp.joglapplicationbase.<init>(joglapplicationbase.java:54)  [java]     @ com.badlogic.gdx.backends.jogamp.joglawtapplication.<init>(joglawtapplication.java:49)  [java]     @ com.mygdx.game.desktop.desktoplauncher.main(desktoplauncher.java:16)  [java] caused by: com.jogamp.openal.alexception: error opening default openal device  [java]     @ com.jogamp.openal.util.alut.alutinit(alut.java:69)  [java]     @ com.badlogic.gdx.bacal lib: (ee) alcplaybackoss_open: not open /dev/dsp: nie ma takiego pliku ani katalogu  [java] kends.jogamp.audio.openalaudio.<clinit>(openalaudio.java:41)  [java]     ... 3 more  [java] exception in thread "main" com.badlogic.gdx.utils.gdxruntimeexception: creating window failed  [java]     @ com.badlogic.gdx.backends.jogamp.joglawtapplication.<init>(joglawtapplication.java:103)  [java]     @ com.mygdx.game.desktop.desktoplauncher.main(desktoplauncher.java:16)  [java] caused by: java.lang.reflect.invocationtargetexception  [java]     @ java.awt.eventqueue.invokeandwait(eventqueue.java:1272)  [java]     @ java.awt.eventqueue.invokeandwait(eventqueue.java:1247)  [java]     @ com.badlogic.gdx.backends.jogamp.joglawtapplication.<init>(joglawtapplication.java:101)  [java]     ... 1 more  [java] caused by: java.lang.classcastexception: com.jogamp.nativewindow.defaultgraphicsconfiguration cannot cast com.jogamp.nativewindow.awt.awtgraphicsconfiguration  [java]     @ com.jogamp.opengl.awt.glcanvas.choosegraphicsconfiguration(glcanvas.java:1557)  [java]     @ com.jogamp.opengl.awt.glcanvas.addnotify(glcanvas.java:615)  [java]     @ java.awt.container.addnotify(container.java:2769)  [java]     @ java.awt.window.addnotify(window.java:770)  [java]     @ java.awt.frame.addnotify(frame.java:487)  [java]     @ java.awt.window.pack(window.java:807)  [java]     @ com.badlogic.gdx.backends.jogamp.joglawtapplication$1.run(joglawtapplication.java:63)  [java]     @ java.awt.event.invocationevent.dispatch(invocationevent.java:241)  [java]     @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:733)  [java]     @ java.awt.eventqueue.access$200(eventqueue.java:103)  [java]     @ java.awt.eventqueue$3.run(eventqueue.java:694)  [java]     @ java.awt.eventqueue$3.run(eventqueue.java:692)  [java]     @ java.security.accesscontroller.doprivileged(native method)  [java]     @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76)  [java]     @ java.awt.eventqueue.dispatchevent(eventqueue.java:703)  [java]     @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:242)  [java]     @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:161)  [java]     @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:150)  [java]     @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:146)  [java]     @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:138)  [java]     @ java.awt.eventdispatchthread.run(eventdispatchthread.java:91) 

using both, app builds fine error appears while i'm trying run it. can me?

my app code (generated using libgdx generator):

package com.mygdx.game;  import com.badlogic.gdx.applicationadapter; import com.badlogic.gdx.gdx; import com.badlogic.gdx.graphics.gl20; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.spritebatch;  public class mygdxgame extends applicationadapter {     spritebatch batch;     texture img;      @override     public void create () {         batch = new spritebatch();         img = new texture("badlogic.jpg");     }      @override     public void render () {         gdx.gl.glclearcolor(1, 0, 0, 1);         gdx.gl.glclear(gl20.gl_color_buffer_bit);         batch.begin();         batch.draw(img, 0, 0);         batch.end();     } } 

and launcher class:

package com.mygdx.game.desktop;  import com.badlogic.gdx.backends.jogamp.*; import com.mygdx.game.mygdxgame;  public class desktoplauncher {     public static void main (string[] arg) {         joglnewtapplicationconfiguration config = new joglnewtapplicationconfiguration();         new joglnewtapplication(new mygdxgame(), config);         // or:         //joglawtapplicationconfiguration config = new joglawtapplicationconfiguration();         //new joglawtapplication(new mygdxgame(), config);     } } 

if openal fail initialize "al lib: (ee) alcplaybackoss_open: not open /dev/dsp: no such file or directory" originate libopenal sound library, failed find raspberry pi soundcard have 3 options:

a) load oss linux kernel driver pi's soundcard

sudo modprobe snd_pcm_oss 

b) disable openal soft oss driver: edit /etc/openal/alsoft.conf , make sure drivers list contains -oss (it disables oss backend tries use non existant dsp file)

c) best solution if openal-soft project can detect oss backend not work , retry using alsa backend, such solution require collaborate , patch openal-soft upstream make openal-soft work out of box on raspberry pi: http://kcat.strangesoft.net/openal.html


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -