SimpleOpenNI fails with Processing 3.0

edited December 2015 in Kinect

I'm getting a no such method error when trying to run simple open ni in processing 3.0a9. This happens when I call

context = new SimpleOpenNI(this);

I assume this is because PApplet has been jettisoned? Putting opengl as my renderer gave me a bit more verbose information. Not sure exactly where to file this issue, since the simpleopenni google code page is no longer active.

java.lang.RuntimeException: java.lang.NoSuchMethodError: processing.core.PApplet.registerDispose(Ljava/lang/Object;)V
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:312)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: processing.core.PApplet.registerDispose(Ljava/lang/Object;)V
    at SimpleOpenNI.SimpleOpenNI.initEnv(SimpleOpenNI.java:383)
    at SimpleOpenNI.SimpleOpenNI.<init>(SimpleOpenNI.java:255)
    at kinectExample.setup(kinectExample.java:25)
    at processing.core.PApplet.handleDraw(PApplet.java:1958)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:566)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:691)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:673)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:442)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1277)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:680)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:77)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:451)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

Answers

  • Sorry I cannot answer, and apologises for somewhat hijacking your thread, but this is a similar error to one I have been getting with a completely project. I am wondering of this has anything to do with a Java update? Or a Processing update? Is it an OpenGL issue? - there are plenty of jogamp.opengl errors in there. Anyone have ANY insight into this?

    java.lang.RuntimeException: java.lang.NoSuchMethodError: processing.core.PVector.set(Lprocessing/core/PVector;)V
        at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoSuchMethodError: processing.core.PVector.set(Lprocessing/core/PVector;)V
        at saito.objloader.OBJModel.setVertex(OBJModel.java:1344)
        at ObJLoader_Transform_SAITO.animation(ObJLoader_Transform_SAITO.java:64)
        at ObJLoader_Transform_SAITO.draw(ObJLoader_Transform_SAITO.java:50)
        at processing.core.PApplet.handleDraw(PApplet.java:2399)
        at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
        at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
    
  • edited December 2015

    NoSuchMethodError: processing.core.PVector.set(Lprocessing/core/PVector;)V

    • In Processing 3, all PVector's methods never "return" void anymore! \m/
    • If a library was compiled under the old PVector class, all methods it tries to access now which once was void won't work anymore for P3! :-S
    • They need to be recompiled under Processing 3's PVector new refactored class.
    • But at least no modifications in the source code are needed. Just a simple recompilation. #:-S
  • Thanks @GoToLoop - and would this be a straightforward process by any chance?

  • edited December 2015

    Most probably you're gonna need to request the library's author to recompile his/her library for Processing 3. I don't have any experience in compiling libraries on my own. X_X

  • edited December 2015

    @GoToLoop - I will see if I can find the author(s). The library is no longer supported, but is still a great tool. I guess your original answer applied to the original question by @aferriss - recompile the library.

  • edited December 2015

    I guess your original answer applied to the original question...

    I'm afraid it's not enough: NoSuchMethodError: processing.core.PApplet.registerDispose(Ljava/lang/Object;)V

    registerDispose() was deprecated in Processing 2 and finally removed in Processing 3! 8-|
    registerDispose() & other similar methods were superseded by registerMethod().

    In short, besides recompilation, that library's source code needs to replace such methods for the most updated registerMethod(). 3:-O

  • edited January 2016

    How hard would it be to take the SimpleOpenNI source and recompile for Processing 3.0 on your own?

    It looks like they have the source available: https://code.google.com/p/simple-openni/source/checkout

    I am admittedly a noob but would this be as simple as opening the source in Xcode or Eclipse and compiling for Processing 3.0? Or maybe JavaScript?

    Pardon my ignorance if I am being so :)

  • I have compiled SimpleOpenNI against openNI2 on OSX and it is working with Processing 3.

    From the source alexdw5 suggests I needed to change a couple of things.

    1) replace parent.registerDispose(this) with parent.registerMethod("dispose", this) everywhere in trunk/SimpleOpenNI-2.0/src/p5_src/SimpleOpenNI.java

    2) strip all comments (lines starting with # that are not compiler directives like #include) from trunk/SimpleOpenNI-2.0/src/SimpleOpenNIMain.i

    3) modify trunk/SimpleOpenNI-2.0/buildOsx.sh to point to the right libraries, includes and architectures. Relevant chunks (which you'd have to tailor for yourself) are:

    echo "--- generate cmake ---"
    cmake -DCMAKE_BUILD_TYPE=Release \
          -DOPEN_NI_BASE=~/src/OpenNI-MacOSX-x64-2.2/ \
          -DOPEN_NI_LIBDIR=~/src/OpenNI-MacOSX-x64-2.2/Redist/ \
          -DNITE_BASE=~/src/NiTE-MacOSX-x64-2.2/ \
          -DNITE_LIBRARY=~/SRC/NiTE-MacOSX-x64-2.2/Redist/libNiTE2.dylib \
          -DEIGEN3D_INCLUDE=/usr/local/include/eigen3/ \
          - DP5_JAR=/Applications/Processing.app/Contents/Java/core/library/core.jar \
          -DCMAKE_OSX_ARCHITECTURES="x86_64" \
          ..
    

    ... and commenting out doc copy (because I disable build of the doc in the next part)

    #copy the doc
    #cp -r ./doc/* ../dist/all/SimpleOpenNI/documentation/
    

    4) hack CMakeLists.txt a bit to and avoid some errors in javadoc creation. The end of trunk/SimpleOpenNI-2.0/CMakeLists.txt now looks like this:

    ADD_CUSTOM_COMMAND(TARGET SimpleOpenNI
                    POST_BUILD
                    COMMAND cmake -E echo "-----------------------------"
                    COMMAND cmake -E echo "Compiling Java files..."
                    COMMAND cmake -E make_directory ./SimpleOpenNI
                    COMMAND cmake -E make_directory ${CMAKE_SWIG_OUTDIR}
                    #COMMAND cmake -E copy_directory ${P5_WRAPPER} ${CMAKE_SWIG_OUTDIR}
                    # cmake copy doesn't support wildcards, otherwise it just copies the hidden folder of svn, etc.
                    # doesn't works on windows backslash
                    COMMAND cp "${P5_WRAPPER}*.java" "${CMAKE_SWIG_OUTDIR}"
                    #COMMAND cmake -E copy ${P5_WRAPPER_FILE} ${CMAKE_SWIG_OUTDIR}
                    COMMAND ${JAVA_COMPILE2} -classpath ${P5_JAR} ${CMAKE_SWIG_OUTDIR}/*.java -d ./
                    )
                    #COMMAND cmake -E echo "-----------------------------"
                    #COMMAND cmake -E echo "Creating jar file..."
                    #COMMAND ${JAVA_ARCHIVE2} cvf SimpleOpenNI.jar SimpleOpenNI
                    #COMMAND cmake -E echo "-----------------------------"
                    #COMMAND cmake -E echo "Creating doc files..."
                    #COMMAND cmake -E make_directory ./doc
                    #COMMAND ${JAVA_DOC} -quiet -author -public -nodeprecated -nohelp -d ./doc  -version ${P5_WRAPPER}/*.java -version ${CMAKE_SWIG_OUTDIR}/ContextWrapper.java
                    #COMMAND ${JAVA_DOC} -classpath ${P5_JAR} -quiet -author -public -nodeprecated -nohelp -d ./doc  -version ${CMAKE_SWIG_OUTDIR}/*.java)
    

    I hope this helps somebody, let me know any questions ;)

  • I do not have a src folder in SimpleOpenNI. I am using processing 3 and Mac OS Sierra.

  • SimpleOpenNI Repository

    I updated the SimpleOpenNi and I can use it with Processing 3, also with Processing 2

    https://github.com/totovr/SimpleOpenni

Sign In or Register to comment.