alessio77
Posts: 8
Joined: Sat Oct 11, 2014 6:54 am

Processing P3D, Raspberry Pi, OpenGL doesn't work

Fri Jul 17, 2015 1:28 pm

to make "Processing" working on the RaspberryPI 2
i've downloaded and copied the content of
the package http://jogamp.org/deployment/jogamp-cur ... atforms.7z
inside the core\library folder of "processing 2.2.1"
(to solve the problem related to OpenGL ...at least i hope to have understood something about the problem )


before this operation the "Processing" error was:

Code: Select all

glGetError 0x500
glGetError 0x500
java.lang.ClassCastException: javax.media.nativewindow.DefaultGraphicsConfiguration cannot be cast to com.jogamp.nativewindow.awt.AWTGraphicsConfiguration
	at javax.media.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1421)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:630)
	at java.awt.Container.addImpl(Container.java:1114)
	at java.awt.Container.add(Container.java:966)
	at processing.opengl.PJOGL.initSurface(PJOGL.java:347)
	at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:6310)
	at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1653)
	at processing.core.PApplet.run(PApplet.java:2256)
	at java.lang.Thread.run(Thread.java:724)

after that the error changed in :

Code: Select all

java.lang.NoClassDefFoundError: javax/media/opengl/GLException
	at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
	at processing.opengl.PGraphicsOpenGL.<init>

(PGraphicsOpenGL.java:518)
	at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at 

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance

(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at processing.core.PApplet.makeGraphics(PApplet.java:1919)
	at 

processing.core.PApplet.size(PApplet.java:1771)
	at processing.core.PApplet.size(PApplet.java:1742)
	at MoveEye.setup(MoveEye.java:25)
	at processing.core.PApplet.handleDraw

(PApplet.java:2361)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
	at processing.core.PApplet.run(PApplet.java:2256)
	at java.lang.Thread.run

(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run

(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass

(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 15 more


have i forgotten to do something after having copied the jars? do i need to update some path or change some configuration? or do something else?

i'm not so skilled with linux, sorry
Don't ban me if i've used the wrong section of the forum or the question was already discussed, please :-(

-Raspberry 2
-Oracle Java 1.7.0_40-b43
-Processing 2.2.1

User avatar
xranby
Posts: 540
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Processing P3D, Raspberry Pi, OpenGL doesn't work

Fri Jul 17, 2015 3:13 pm

Hi Processing 2.x.x is built around the concept that all windows inherit a java applet surface and thus indirectly is using an AWT X11 Window surface.
The proprietary Broadcom Raspbery Pi OpenGL ES driver is using a dispmanx surface that is incompatible with AWT X11 Window surfaces.

JogAmp JOGL, that processing is using internally, can initialize the Broadcom specific dispmanx surface using the NEWT API.
Processing 3.x.x has removed all support for applets and thus switched from using AWT to NEWT for all P3D sketches!
This means that hardware acceleration with processing on the raspberry pi is possible when using Processing 3.

As a proof of concept
Image
video: http://labb.zafena.se/jogamp/vc4/video2 ... 245117.mp4

As you can see in this image NEWT uses the dispmanx api to provide a hardware accelerated window on top of the xorg window, NEWT also provide a "white" mousepointer.

The above image was generated by combining the latest jogl git + a patched version of processing to initialize a gl2es2 profile and removing some calls that cased runtime exceptions using the raspberry pi opengl es 2 driver.
https://github.com/xranby/processing/co ... .0-rebased

I am collaborating with Gottfried Haider to merge all the changes to progessing that made this possible into the future Processing 3 release.


One alternative is to use the new free software Mesa3D vc4 OpenGL 2 driver.
The new Mesa3D vc4 driver expects use of AWT X11 Windows thus it shall work with both Processing 2 and Processing 3.
viewtopic.php?f=81&t=115350
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

Return to “Java”