Problems with OpenGl on Raspberry Pi

I am seeking help on resolving this OPENGL issue on the Raspberry PI. Here is the error message when trying to compile the code.

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:1350)
   at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:581)
   at java.awt.Container.addImpl(Container.java:1114)
   at java.awt.Container.add(Container.java:966)
   at processing.opengl.PJOGL.initSurface(PJOGL.java:326)
   at processing.opengl.PGraphicsOpenGL.initPrimary(PGraphicsOpenGL.java:5988)
   at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1600)
   at processing.core.PApplet.run(PApplet.java:2177)
   at java.lang.Thread.run(Thread.java:724)

Answers

  • P.S. I have upgraded Java to:

    java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)

  • edited January 2014 Answer ✓

    hello, the problem is that the opengl output cannot be drawn into an AWT frame (which it is what Processing uses):

    https://jogamp.org/bugzilla/show_bug.cgi?id=626

    You would need to override Processing's frame and create a native window to draw the opengl canvas to. I started writing a utility library precisely for that purpose:

    https://github.com/processing/processing/tree/master/java/libraries/glw

    It is far from finished, but you could try using it on the raspberry pi (you need to build and install it manually, is not included in Processing's build script):

    import processing.glw.*;
    
    void setup() {
      size(640, 360, GLW.P2D);
      frameRate(180);
    }
    
    void draw() {
      background(255, 0, 0);
    
      fill(255);
    }
    

    Because Processing still creates the AWT frame, you would briefly see two windows, but then the library hides Processing's so only the native window is visible at the end.

  • Hello,

    I have compiled and run the LargeStage example on the Raspberry Pi using the latest version of Raspbian (January 2014). I am getting the following error:

    javax.media.opengl.GLException: Not a GL2ES2 implementation
        at jogamp.opengl.es1.GLES1Impl.getGL2ES2(GLES1Impl.java:4886)
        at processing.opengl.PJOGL.getGL(PJOGL.java:657)
        at processing.glw.PNEWT.access$0(PNEWT.java:1)
        at processing.glw.PNEWT$DummyListener.init(PNEWT.java:212)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:617)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:663)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:649)
        at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:399)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1119)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:994)
        at jogamp.opengl.GLAutoDrawableBase.defaultDisplay(GLAutoDrawableBase.java:432)
        at com.jogamp.opengl.GLAutoDrawableDelegate.display(GLAutoDrawableDelegate.java:167)
        at processing.glw.PNEWT.requestDraw(PNEWT.java:141)
        at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1651)
        at processing.core.PApplet.run(PApplet.java:2254)
        at java.lang.Thread.run(Thread.java:724)
    

    Thanks.

  • edited April 2014

    @ebranda

    I have been having the same issue. javax.media.opengl.GLException: Not a GL2ES2 implementation is resolved by editing PNEWT.java as suggested by codeanticode. Then you need to build GLW, and then build Processing. There is another issue following that though (at least for me).

    See: forum.processing.org/two/discussion/4329/problem-building-processing-from-source-for-raspberry-pi-newt-p3dopengl#Item_2

Sign In or Register to comment.