EGLDisplayUtil error – Processing on Raspberry

edited October 2016 in Raspberry PI

Hello everyone,

I'm working on a raspberry and when I run it, I everytime have this error in the console: (but the sketch run even though)

EGLDisplayUtil.EGLDisplays: Shutdown (open: 1)
EGLDisplayUtil: Open EGL Display Connections: 1
EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]

Do you know what does it mean and how I can solve it? The sketch read the values of the arduino (plugged on the raspberry) where a proximity sensor is plugged and when we put an object above the sensor the first video change and another one is launched. I also have another problem: When the sketch is running, the videos are slow down. And I remove everything that relate to the arduino and the sensor in processing, the videos are fine.

So is somebody can help me for this, it drives me crazy, and I didn't found a thing on our friend Google... Thanks so much :)

Here my code:

    ////////////////////////////////////////////
    ////////////////////////////////// LIBRARIES
    ////////////////////////////////////////////

    import processing.serial.*;
    import processing.video.*;





    /////////////////////////////////////////////////
    ////////////////////////////////// INITIALIZATION
    /////////////////////////////////////////////////

    Movie mymovie;
    Movie mymovie2;





    ////////////////////////////////////////////
    ////////////////////////////////// VARIABLES
    ////////////////////////////////////////////

    int lf = 10;    // Linefeed in ASCII
    String myString = null;
    Serial myPort;  // The serial port
    int sensorValue = 0; //value of the sensore
    int x = 100; //the sensor will be triggered when this value is reached. Modify it to change when the videos will switch




    /////////////////////////////////////////////
    ////////////////////////////////// VOID SETUP
    /////////////////////////////////////////////

    void setup() {
      //frameRate(50);
      fullScreen();
      //size(1280, 1024, P3D);
      // List all the available serial ports
      printArray(Serial.list());
      // Open the port you are using at the rate you want:
      myPort = new Serial(this, Serial.list()[1], 9600);
      myPort.clear();
      // Throw out the first reading, in case we started reading 
      // in the middle of a string from the sender.
      myString = myPort.readStringUntil(lf);
      myString = null;
      //load the video
      mymovie = new Movie(this, "VIDEO_1_v06bis.mov"); //Modify the line in quotation marks to change the videos. (put it inside the "data" folder
      mymovie2 = new Movie(this, "VIDEO_2_v02.mov");
      //set the videos for a continuous loop
      mymovie.loop();
      mymovie2.loop();
    }




    ////////////////////////////////////////////
    ////////////////////////////////// VOID DRAW
    ////////////////////////////////////////////

    void draw() {
      //image(mymovie, 0, 0); //display the video in a continuous loop
      // to trigger the sensor
      // check if there is something new on the serial port
      while (myPort.available() > 0) {
        // store the data in myString 
        myString = myPort.readStringUntil(lf);
        // check if we really have something
        if (myString != null) {
          myString = myString.trim(); // let's remove whitespace characters
          // if we have at least one character...
          if (myString.length() > 0) {
            println(myString); // print out the data we just received
            // if we received a number (e.g. 123) store it in sensorValue, we sill use this to change the background color. 
            try {
              sensorValue = Integer.parseInt(myString);
            } 
            catch(Exception e) {
            }
          }
        }
      }


      ///////////SENSOR TRIGGERED
      ///////////////////////////

      if (x < sensorValue) {
        mymovie.jump(0);
        //background(mymovie2);
        image(mymovie2, mouseX, mouseY);
        //mymovie2.pause();
      } else {
        //mymovie2.play();
        //mymovie.jump(0);
      }


      ///////////SENSOR NOT TRIGGERED
      ///////////////////////////////

      if (x > sensorValue) {
        mymovie2.jump(0);
        //background(mymovie);
        image(mymovie, mouseX, mouseY);
        //mymovie.pause();
      } else {
        //mymovie.play();
      }
    }



    //////////////////////////////////////////////
    ////////////////////////////////// VOID CUSTOM
    //////////////////////////////////////////////

    void movieEvent(Movie mymovie) {
      mymovie.read(); //read the video
      mymovie2.read();
    }

Answers

  • Actually this error was simply because I forget to remove "P3D" in the size line, so this problem is solved. But the videos are still slow down... And frameRate does not change a thing.

    Thanks again :)

  • edited October 2016

    You're wasting precious CPU time by calling read() for both of your Movie objects within movieEvent()!
    Only call read() for the current triggered Movie instead:

    void movieEvent(final Movie m) {
      m.read();
    }
    

    Also you should place your readString() + trim() inside serialEvent().

    void serialEvent(final Serial s) {
      myString = s.readString().trim();
    }
    

    And don't forget to call bufferUntil(ENTER); over the Serial instance inside setup()! L-)

    Some forum links about it:

    https://forum.Processing.org/two/discussion/16435/how-to-make-the-webcam-capture-window-go-away-or-put-images-over-it

    https://forum.Processing.org/two/discussion/16618/processing-with-arduino-void-serialevent#Item_5

  • Don't use the Video library, since this does the video decoding on the CPU. Instead, use the GLVideo library in combination with H.264 encoded videos. For this you'll need to put the P3D back, however. Those warnings are harmless, btw.

  • Hi, and thanks so much guys for your reply :), I'll try it today and I tell you what's new.

  • So I tried everything you said, and it works about GoToLoop said but unfortunately it doesn't works for GLVideo, I installed the library and do everything like in the examples and the raspberry freeze on a blackscreen :/ I the only thing I can do is ctrl+alt+f1 and sudo reboot ^^

    Then I tried with SingleVideo.pde example and it works, but it's still slow down... Sometimes it's slow and sometimes it's fast (too fast). Then I tried again with processing.video and it's work fine. The video is not slow down or other... It's just baffling :'(

    Thanks again for your help :)

  • @lxnr_p Does the SingleVideo.pde of GLVideo works for you with the video file it came with?

  • Damn it, yes it's works, awkward... ^^ I though the format was good, but it was photo-jpeg using h264 codec... I will change it. I hope it will work better with my sketch then.

    I tell you if it's good or not. Thanks again for your help :)

Sign In or Register to comment.