3D Render in Processing 3

edited February 2017 in Library Questions

Hi, I got changed my GUI in Processing3. Now I have issues with the 3d Render. I get this error message:

translate(), or this particular variation of it, is not available with this renderer. rotateX() can only be used with a renderer that supports 3D, such as P3D.

I tested with P3D and PDF. For controls i use Java AWT.

    @ Override    
    public void settings() {
      size(1300, 700);      P3D or PDF
    }

    @ Override
    public void setup(){

        menu_setup();
    }

    void menu_setup(){
     mainFrame = new Frame();
     menuListen = new myMenuListener();
     myMenu = new MenuBar();
     mainFrame.setMenuBar(myMenu);
     mainFrame.setVisible(true);
    }

can anybody help me?

Regards Willi

Answers

  • Format your code. Edit post, select code and hit ctrl+o. Ensure there is an empty line above and below your code block.

    Kf

  • Sorry, and thanks

  • and the imports?

  • and the member declarations?

    and myMenuListener()?

  • In the MainClass

    import processing.core.*;
    import processing.awt.PSurfaceAWT;
    
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.CheckboxMenuItem;
    import java.awt.MenuBar;
    import java.awt.Menu;
    import java.util.*;
    
    import jssc.SerialPortList;
    import jssc.SerialPort;
    
    import codeanticode.gsvideo.*;
    

    In the used class.

    import processing.core.*;
    //import processing.opengl.*;  do not work
    

    Willi

  • The whole Flyer class

    package kucky;
    
    import processing.core.*;
    //import processing.opengl.*;
    //import static processing.core.PApplet.println;
    /**
     *
     * @author Kucky
     */
    public class Flyer {
        PApplet pa;
    
        int c = 0xFF100DFF;
        int lightBlue = 0xFF5A99F0;
        int midGrey   = 0xFF535554;
        int redRotor  = 0xFFFF0C1C;
        int blueRotor = 0xFF100DFF;
    
        int posX, posY;
        float fac;
    
        float rotorDia    = 60;
        float rotorLength = 80;
        float line10      = 10;
        float line25      = 25;
        float line80      = 80;
        boolean x_Wing    = true;
    
        float flyerXoffset = 0;
        float flyerYoffset = 180.0f;   
        float t_FlyerZoffset = 180.0f; 
        float x_FlyerZoffset = 45.0f;
    
        float yaw = 0;   /// Only for testing
    
        Flyer(PApplet _p, int _posX, int _posY, float _dim) {
    
            pa   = _p;        
            posX = _posX;
            posY = _posY;
            fac  = _dim;    
        }
    //--------------------------- end of constructor --------------------------------------------------
    
        public void drawFlyer(float _angX, float _angY, float _angZ) {
    
    /* Testarea */          pa.pushMatrix();  
                            pa.translate(posX, posY);    
                            pa.fill(255);                             /// only for testing            
                            float pitch = pa.map(pa.mouseY, -350, 350, -90, 90);
     //                     pa.text("Pitch: "+pitch, 300, -230);
                            float roll = pa.map(pa.mouseX, -650, 650, -90, 90);
     //                     pa.text("Roll: "+roll, 300, -210); 
                            pa.text("yaw = :"+yaw, 150, 50);
                            pa.popMatrix();
    /* End of Testarea */ 
    
        pa.pushMatrix();  
        pa.translate(posX, posY);
    
            pa.scale(fac);
    
        pa.rotateX(pa.radians(flyerXoffset+pitch));            /// Maus X simuliert Pitch
        pa.rotateY(pa.radians(flyerYoffset+roll));           /// Maus Y simuliert Roll
    
        if(x_Wing){
            pa.rotate(pa.radians(x_FlyerZoffset));
    
            if(pa.keyPressed){
                if(pa.key =='l')
                    x_FlyerZoffset--;
                else if(pa.key =='r')    
                    x_FlyerZoffset++;                              
            }       
        }
        pa.stroke(255, 0, 0);
    
            pa.beginShape();
                pa.strokeWeight(1);
                pa.stroke(255);
                pa.fill(lightBlue);           
                pa.vertex(0, line80);        /// First Point unten Mitte
                pa.vertex(-line10, line25);
                pa.vertex(-line25, line10);               
                pa.vertex(-line80, 0);
                pa.vertex(-line25, -line10);
                pa.vertex(-line10, -line25);                
                pa.vertex( 0, -line80);
                pa.vertex(line10, -line25);
                pa.vertex(line25, -line10);                
                pa.vertex(line80, 0);
                pa.vertex(line25, line10);
                pa.vertex(line10, line25);                
            pa.endShape(pa.CLOSE);
    
            pa.stroke(midGrey);
                if(x_Wing) {
                    pa.fill(redRotor);                                  
                    pa.ellipse(-rotorLength, 0, rotorDia, rotorDia);     /// West 
                    pa.fill(blueRotor);                                  
                    pa.ellipse(0, rotorLength, rotorDia, rotorDia);      /// South              
                }
    
            pa.fill(redRotor);                                  
            pa.ellipse(0, -rotorLength, rotorDia, rotorDia);            /// North              
            pa.fill(blueRotor);                                  
            pa.ellipse(rotorLength, 0, rotorDia, rotorDia);             /// East 
    
        pa.popMatrix();      // end drawFlyer                   
        }
    //--------------------------- end of drawFlyer() -------------------------------------------------- 
    
    //    public void setMode(boolean _mode) {
    //        x_Wing = _mode;  
    //    }
    //--------------------------- end of setMode() ---------------------------------------------------- 
    
        public void keyPressed() {
            pa.keyPressed();
            pa.println("Key is pressed");   
            if(pa.key == 'r')
                yaw++;
            else
                yaw--;
    
        }
    }
    /// ------------------------------------------- end of Flyer class --------------------------------
    
  • edited February 2017

    that's better

    pa.translate(posX, posY);
    

    you can't translate with two arguments in 3d space. just past 0 for z.

    (oops, i should've re-read the original post, was a 2d error, not a 3d error.)

  • Use size with P3D as 3rd parameter

  • edited February 2017

    Thanks for your supports. If i use P3D as 3rd Parameter, i get this message.

    Here the main Class

    package kucky;
    
    import processing.core.*;
    import processing.awt.PSurfaceAWT;
    
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.CheckboxMenuItem;
    import java.awt.MenuBar;
    import java.awt.Menu;
    import java.util.*;
    
    import jssc.SerialPortList;
    import jssc.SerialPort;
    
    import codeanticode.gsvideo.*;
    
    /**
    *
    * @ author Willi
    */
    @ SuppressWarnings("serial")
    public class P5Main_Menu extends PApplet{
    
        GSCapture cam;
    
        Frame mainFrame;
        MenuBar myMenu;
        Menu fileMenu, editMenu, portMenu, bauteMenu, camMenu;
        MenuItem fileMode, fileExit, editOption1, editOption2;
        MenuItem com3, com4, com5, com6, com7;
        MenuItem txt9600, txt56700, txt115200;
        CheckboxMenuItem  splitBlur,splitMed; 
    
        myMenuListener menuListen;
    
        //Owen classes
        Horizon horizon;
        Flyer flyer;
        Compass compass;
        Altimeter altimeter;
        RollLevel rollLevel;
        PitchLevel pitchLevel;
        SpeedControl speedControl;   
        SerialConnect serialConnect;
    
        static private final int BARHEIGHT    = 30;
    
        static private final int HOR_POS_X    = 750;
        static private final int HOR_POS_Y    = 450;
        static private final float HOR_SIZE   = 0.8f;
    
        static private final int COMP_POS_X   = 450;
        static private final int COMP_POS_Y   = 450;
        static private final float COMP_SIZE  = 0.8f;
    
        static private final int FLYER_POS_X   = 1000;
        static private final int FLYER_POS_Y   = 450;
        static private final float FLYER_SIZE  = 0.8f;
    
        static private final int ALTI_POS_X   = 450;
        static private final int ALTI_POS_Y   = 150;
        static private final float ALTI_SIZE  = 0.8f;
    
        static private final int ROLL_POS_X   = 700;
        static private final int ROLL_POS_Y   = 200;
        static private final float ROLL_SIZE  = 1.0f;
    
        static private final int PITCH_POS_X   = 700;
        static private final int PITCH_POS_Y   = 200;
        static private final float PITCH_SIZE  = 1.0f;
    
        static private final int THROTTLE_POS_X   = 150;
        static private final int THROTTLE_POS_Y   = 350;
        static private final float THROTTLE_SIZE  = 0.8f; 
    
        private final int DEVICECOLOR = color(90, 100, 90);
        private final int DEVICEFRAMECOLOR = color(190);
    
        float angY = 0;
        float angX = 0;
        float angZ = 0;
    
        int   altiude = 0;
        int   throttle,
              power_N,
              power_E,
              power_S,
              power_W;
    
        int bg = color(30, 30, 30);
    
        PFont dirFont, infoFont;
    
    /**--------------------------- end of declarations and initialisations ---------------------------*/
    
    @ Override    
    public void settings() {
      size(1300, 700, P3D);
    }    
    /**--------------------------- end of settings() -------------------------------------------------*/
    
    @ Override
    public void setup(){
    
        dirFont  = loadFont("ArialMT-24.vlw");
        infoFont = loadFont("ArialMT-12.vlw");
    
        horizon       = new Horizon(this, HOR_POS_X, HOR_POS_Y, HOR_SIZE); 
        flyer         = new Flyer(this, FLYER_POS_X, FLYER_POS_Y, FLYER_SIZE);
        compass       = new Compass(this, COMP_POS_X, COMP_POS_Y, COMP_SIZE); 
        altimeter     = new Altimeter(this, ALTI_POS_X, ALTI_POS_Y, ALTI_SIZE, DEVICECOLOR,DEVICEFRAMECOLOR);
        rollLevel     = new RollLevel(this, ROLL_POS_X, ROLL_POS_Y, ROLL_SIZE, DEVICECOLOR,DEVICEFRAMECOLOR);
        pitchLevel    = new PitchLevel(this, PITCH_POS_X, PITCH_POS_Y, PITCH_SIZE, DEVICECOLOR,DEVICEFRAMECOLOR);  
        speedControl  = new SpeedControl(this, THROTTLE_POS_X, THROTTLE_POS_Y, THROTTLE_SIZE, DEVICECOLOR,DEVICEFRAMECOLOR);  
        serialConnect = new SerialConnect();
    
           ///-------- Camera part 
        String[] cameras = GSCapture.list();
    
        if (cameras.length == 0)
        {
            println("There are no cameras available for capture.");
            exit();
        } else {
            println("Available cameras:");
            for (int i = 0; i < cameras.length; i++) {
                println(cameras[i]);
            }
        }
    
    //    cam = new GSCapture(this, 640, 480, cameras[0]);
    //    cam.start();      
    //    RefreshCOMport();
    
        menu_setup();
    }
    /**--------------------------- end of setup ------------------------------------------------------*/
    
    @ Override
    public void draw(){
            background(30, 30, 30);       
            pushMatrix();
            translate(width/2, height/2);          
    
    /**-- Testarea --*/      strokeWeight(1);                    /// Only for creating                                
                            line(-640, 0, 640, 0);
                            line(0, -340, 0, 340); 
                            fill(255);
                            textFont(infoFont);                                                                                            
                            float mouseXPos = (int)map(mouseX, 0, 1300, -650, 650);
                            text("Mouse X : "+mouseXPos+"  /  "+mouseX, -600, 190);  
                            float mouseYPos = (int)map(mouseY, 0, 700, 350, -350);
                            text("Mouse Y : "+mouseYPos+"  /  "+mouseY, -600, 210);
    
                            float angX = (int)map(mouseX, 0, 1300, -90, 90);
                            text("Roll: "+angX, -600, 230);
                            float angY = (int)map(mouseY, 0, 700, -90, 90);
                            text("Pitch: "+angY, -600, 250);
    
                            angZ = angX;
    /**-- End of testarea --*/        
        //-------------------------------------------------draw video part  
            rectMode(CENTER);
            stroke(255);
            rect(440, -160, 330, 250, 5);
            fill(127, 127, 127);    
    
    /**        if(runCamera){
                if (cam.available()) {
                    println("Camera");
                    cam.read();
                } 
            image(cam, 280, -280); 
            }  
    */
        //-------------------------------------------------end of video part     
            popMatrix();
    
            horizon.drawHorizon(angX, angY, angZ); 
            compass.drawCompass(angZ);              
            altimeter.drawAltimeter(altiude);
            rollLevel.DrawRollLevel(angX);
            pitchLevel.DrawPitchLevel(angY);
            flyer.drawFlyer(angX, angY, angZ);    
            speedControl.drawSpeedControl(throttle, power_N, power_E, power_S, power_W); 
    
    }
    /**--------------------------- end of draw -------------------------------------------------------*/
    
        public void RefreshCOMport() {                    
    
            String[] portNames = SerialPortList.getPortNames();
    
            String[] listIteme = new String[portNames.length+1];      
    
            if(portNames.length > 0)
     //           isCOMport = true;
    
            for (int i = 0; i < portNames.length; i++){
    
                listIteme[i] = portNames[i];
                println(portNames[i]);
            }
    //        listIteme[portNames.length] = "Close Port";
    
    }
    //---------------------------- End of ConnectBoc() --------------------------------------------
    
     class myMenuListener implements ActionListener, ItemListener {
    
     myMenuListener(){
     }
    
     public void actionPerformed(ActionEvent e) {
        MenuItem source = (MenuItem)(e.getSource());
        String s = "Action event detected."
         + "    Event source: " + source.getLabel()
         + " (an instance of " + getClassName(source) + ")";
        println(s);
    
        //this part changes the background colour
        if(source.equals(fileMode)){
            println("Mode");
        }
        else if(source.getLabel().equals("Option 1")){
            println(" Option 1 window");
        }
        else if(source.getLabel().equals("Option 2")){
            println(" Option 2 window");
        }
        else println(" etc. etc..");
     }
    
       @ Override
            public void itemStateChanged(ItemEvent e) {
    
            MenuItem source = (MenuItem)(e.getSource());
            String s = "Action event detected."
             + "    Event source: " + source.getLabel()
             + " (an instance of " + getClassName(source) + ")";
            println(s);
    
            //this part changes the background colour
            if(source.getLabel().equals("Mode")){
                println("Load a layer");
            }
            else if(source.getLabel().equals("Option 1")){
                println(" Option 1 window");
            }
            else if(source.getLabel().equals("Option 2")){
                println("Option 2 window");
            }
            else println(" etc. etc.."); 
            } 
    
        }
    /**--------------------------- end of myMenuListener class ---------------------------------------*/
    
    protected String getClassName(Object o) {
          String classString = o.getClass().getName();
          int dotIndex = classString.lastIndexOf(".");
          return classString.substring(dotIndex+1);
    } 
    /**--------------------------- end of getClassName() ---------------------------------------------*/
    
    void menu_setup(){
     mainFrame = new Frame();
     menuListen = new myMenuListener();
     myMenu = new MenuBar();
     mainFrame.setMenuBar(myMenu);
     mainFrame.setVisible(true);
    
     //create the top level button
     fileMenu = new Menu("File");
     editMenu = new Menu("Edit");
     portMenu = new Menu ("Port");
     bauteMenu = new Menu("Baute");
     camMenu = new Menu("Camera");
    
     //create all the Menu Items and add the menuListener to check their state.
     fileMode = new MenuItem("Mode");
     fileMode.addActionListener(menuListen);
     fileExit = new MenuItem("Exit");
     fileExit.addActionListener(menuListen);
     editOption1 = new MenuItem("Option 1");
     editOption1.addActionListener(menuListen);
     editOption2 = new MenuItem("Option2");
     editOption2.addActionListener(menuListen);
    
     com3 = new MenuItem("COM3");
     com3.addActionListener(menuListen);
     com4 = new MenuItem("COM4");
     com4.addActionListener(menuListen);
     com5 = new MenuItem("COM5");
     com5.addActionListener(menuListen);
     com6 = new MenuItem("COM6");
     com6.addActionListener(menuListen);
     com7 = new MenuItem("COM7");
     com7.addActionListener(menuListen);
    
     txt9600 = new MenuItem("9600");
     txt9600.addActionListener(menuListen);
     txt56700 = new MenuItem("56700");
     txt56700.addActionListener(menuListen);
     txt115200 = new MenuItem("115200");
     txt115200.addActionListener(menuListen);
    
     splitBlur = new CheckboxMenuItem("Blur",false);
     splitBlur.addActionListener(menuListen);
     splitMed = new CheckboxMenuItem("Median",true);
     splitMed.addActionListener(menuListen);
    
     fileMenu.add(fileMode);
     fileMenu.addSeparator();
     fileMenu.add(fileExit);
    
     editMenu.add(editOption1);
     editMenu.add(editOption2);
    
     portMenu.add(com3);
     portMenu.add(com4);
     portMenu.add(com5);
     portMenu.add(com6);
     portMenu.add(com7);
    
     bauteMenu.add(txt9600);
     bauteMenu.add(txt56700);
     bauteMenu.add(txt115200);
    
    // add the button to the menu
     myMenu.add(fileMenu);
     myMenu.add(editMenu);
     myMenu.add(portMenu);
     myMenu.add(bauteMenu);
     myMenu.add(camMenu);
    
     //add the menu to the frame!
      PSurfaceAWT awtSurface = (PSurfaceAWT)surface;
      PSurfaceAWT.SmoothCanvas smoothCanvas = (PSurfaceAWT.SmoothCanvas)awtSurface.getNative();
      smoothCanvas.getFrame().setMenuBar(myMenu);
    }
    /**--------------------------- end of menu_setup() -----------------------------------------------*/
    /**
     * @ param passedArgs the command line arguments
     */
    static public void main(String[] passedArgs) {
        String[] appletArgs = new String[] {P5Main_Menu.class.getName()};
        if (passedArgs != null) {
          PApplet.main(concat(appletArgs, passedArgs));
        } else {
          PApplet.main(appletArgs);
        }
      }
    /**--------------------------- end of main() -----------------------------------------------------*/
    }
    /**--------------------------- end of P5Main_Menu.class ------------------------------------------*/
    

    This error message

    java.lang.NoSuchMethodError: com.jogamp.common.util.IOUtil$ClassResources.<init>([Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/Class;)V
        at processing.opengl.PSurfaceJOGL.initIcons(PSurfaceJOGL.java:537)
        at processing.opengl.PSurfaceJOGL.initFrame(PSurfaceJOGL.java:137)
        at processing.core.PApplet.initSurface(PApplet.java:10451)
        at processing.core.PApplet.runSketch(PApplet.java:10338)
        at processing.core.PApplet.main(PApplet.java:10057)
        at kucky.P5Main_Menu.main(P5Main_Menu.java:359)
    D:\Benutzer\Willi\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
    BUILD FAILED (total time: 1 second)
    

    Gruß Willi

  • Did you have this sketch running in Processing 2? Are you trying to update it for Processing 3?

  • Yes, in Processing 2 it works fine. Now i would update to Processing 3. My IDE ist Netbeans.

  • You will not be able to update the code easily because of changes introduced in PS3.

    In PS2 the PApplet class was a windowed component, in other words had a visual component, but in PS3 this is no longer the case so it is extremely difficult to embed a PApplet into a Java application.

    Also in PS2 all 3 renderers (JAVA2D, P2D and P3D) were displayed inside a java.swing.JFrame in PS3 the P2D and P3D renderers are displayed inside a com.jogamp.newt.opengl.GLWindow making it difficult to use in a Java application.

  • @quark Then what are the JAVA2D based ones displayed with? The same old java.swing.JFrame?

  • Thank you for the explanation. I suspected it. Can you show me a small example? Netbeans-Jawa-Processing3 and a 3d object. I could go on with it. Have a nice day.

  • @Lord_of_the_Galaxy

    JAVA2D sketches are still displayed in a JFrame but it is implemented differently in PS3

    @kucky

    I don't have a simple or even a hard example of how to embed a Processing 3 sketch inside a Java Swing application, in fact AFAIK it's not possible. In G4P I use PApplet.runSketch(...) to launch multiple windows but this will not allow me to embed into another window.

  • Thanks at all. I think i got a solution. If I still have a question about GSVideo, I sign up again. Have a nice Weekend

  • If you find a solution please post it here.

  • edited February 2017

    I will do my best. I´m not a expert. The Flyer move in the 3D space. This is OK. But i can not add a menu.

    The Main Class

    package kucky;
    
    import java.awt.CheckboxMenuItem;
    import java.awt.Menu;
    import java.awt.MenuBar;
    import java.awt.MenuItem;
    import processing.core.*;
    
    import codeanticode.gsvideo.*;
    
    import processing.awt.PSurfaceAWT;
    /**
    *
    * @ author Willi
    */
    @ SuppressWarnings("serial")
    public class P5Main extends PApplet{
    
        GSCapture cam;
    
        MenuBar myMenu;
        Menu fileMenu, editMenu, portMenu, bauteMenu, camMenu;
        MenuItem fileMode, fileExit, editOption1, editOption2;
        MenuItem com3, com4, com5, com6, com7;
        MenuItem txt9600, txt56700, txt115200;
        CheckboxMenuItem  splitBlur,splitMed; 
    
    //    myMenuListener menuListen;
    
        static private final int FLYER_POS_X   = 1000;
        static private final int FLYER_POS_Y   = 450;
        static private final float FLYER_SIZE  = 0.8f;
    
    Flyer flyer;
    
    @ Override    
    public void settings() {
      size(1300, 700, P3D);
    }    
    
    @ Override
    public void setup(){
      noStroke();
    //  MenuBar myMenu = new MenuBar();
    //  Menu fileMenu = new Menu("File");
    //  myMenu.add(fileMenu);
    //  PSurfaceAWT awtSurface = (PSurfaceAWT)surface;
    //  PSurfaceAWT.SmoothCanvas smoothCanvas = (PSurfaceAWT.SmoothCanvas)awtSurface.getNative();
    //  smoothCanvas.getFrame().setMenuBar(myMenu);
    
      flyer = new Flyer(this, FLYER_POS_X, FLYER_POS_Y, FLYER_SIZE);
    
    }
    
    //@ Override
    public void draw(){
          background(30, 30, 30);
    
        flyer.drawFlyer(90, 90, 0);
    
    }
    
    /**
     * @ param passedArgs the command line arguments
     */
    static public void main(String[] passedArgs) {
        String[] appletArgs = new String[] {P5Main.class.getName()};
        if (passedArgs != null) {
          PApplet.main(concat(appletArgs, passedArgs));
        } else {
          PApplet.main(appletArgs);
        }
      }
    }
    

    The Flyer Class

    package kucky;
    
    import processing.core.PApplet;
    
    public class Flyer {
    
        int posX, posY;
        float fac;
    
        int c = 0xFF100DFF;
        int lightBlue = 0xFF5A99F0;
        int midGrey   = 0xFF535554;
        int redRotor  = 0xFFFF0C1C;
        int blueRotor = 0xFF100DFF;
    
        float rotorDia    = 60;
        float rotorLength = 80;
        float line10      = 10;
        float line25      = 25;
        float line80      = 80;
        boolean x_Wing    = true;
    
    
        float flyerXoffset = 0;
        float flyerYoffset = 180.0f;   
        float t_FlyerZoffset = 180.0f; 
        float x_FlyerZoffset = 45.0f;
    
        float yaw = 0;   /// Only for testing
    
        private static PApplet parent;
    
        /**
        * Flyer constructor
        * @ param parent PApplet
        */
        public Flyer(PApplet parent, int _posX, int _posY, float _dim) {
            this.parent = parent;
    
            posX = _posX;
            posY = _posY;
            fac  = _dim; 
        }
    
    
        public void drawFlyer(float _angX, float _angY, float _angZ) {
    
    /* Testarea */          parent.pushMatrix();  
                            parent.translate(posX, posY);    
                            parent.fill(255);                             /// only for testing            
                            float pitch = parent.map(parent.mouseY, -350, 350, -90, 90);
     //                     parent.text("Pitch: "+pitch, 300, -230);
                            float roll = parent.map(parent.mouseX, -650, 650, -90, 90);
     //                     parent.text("Roll: "+roll, 300, -210); 
                            parent.text("yaw = :"+yaw, 150, 50);
                            parent.popMatrix();
    /* End of Testarea */ 
    
        parent.pushMatrix();  
        parent.translate(posX, posY, 0);    
    
            parent.scale(fac);
    
        parent.rotateX(parent.radians(flyerXoffset+pitch));            /// Maus X simuliert Pitch
        parent.rotateY(parent.radians(flyerYoffset+roll));           /// Maus Y simuliert Roll
    
        if(x_Wing){
            parent.rotateZ(parent.radians(x_FlyerZoffset));
    
            if(parent.keyPressed){
                if(parent.key =='l')
                    x_FlyerZoffset--;
                else if(parent.key =='r')    
                    x_FlyerZoffset++;                              
            }       
        }
        else{        
            parent.rotateZ(parent.radians(t_FlyerZoffset)); 
    
            if(parent.keyPressed){
                if(parent.key =='l')
                    t_FlyerZoffset--;
                else if(parent.key =='r')    
                    t_FlyerZoffset++;                              
            }
        }
        parent.stroke(255, 0, 0);
    
            parent.beginShape();
                parent.strokeWeight(1);
                parent.stroke(255);
                parent.fill(lightBlue);           
                parent.vertex(0, line80);        /// First Point unten Mitte
                parent.vertex(-line10, line25);
                parent.vertex(-line25, line10);               
                parent.vertex(-line80, 0);
                parent.vertex(-line25, -line10);
                parent.vertex(-line10, -line25);                
                parent.vertex( 0, -line80);
                parent.vertex(line10, -line25);
                parent.vertex(line25, -line10);                
                parent.vertex(line80, 0);
                parent.vertex(line25, line10);
                parent.vertex(line10, line25);                
            parent.endShape(parent.CLOSE);
    
            parent.stroke(midGrey);
                if(x_Wing) {
                    parent.fill(redRotor);                                  
                    parent.ellipse(-rotorLength, 0, rotorDia, rotorDia);     /// West 
                    parent.fill(blueRotor);                                  
                    parent.ellipse(0, rotorLength, rotorDia, rotorDia);      /// South              
                }
                else {
                    parent.fill(blueRotor);                                  
                    parent.ellipse(-rotorLength, 0, rotorDia, rotorDia);     /// West 
                    parent.fill(redRotor);                                  
                    parent.ellipse(0, rotorLength, rotorDia, rotorDia);      /// South              
                }             
            parent.fill(0, 255, 0);                                  
            parent.ellipse(0, -rotorLength, rotorDia, rotorDia);            /// North              
            parent.fill(blueRotor);                                  
            parent.ellipse(rotorLength, 0, rotorDia, rotorDia);             /// East 
    
        parent.popMatrix();      // end drawFlyer                   
        }
    //--------------------------- end of drawFlyer() -------------------------------------------------- 
    
        public void setMode(boolean _mode) {
            x_Wing = _mode;  
        }
    //--------------------------- end of setMode() ---------------------------------------------------- 
    
        public void keyPressed() {
            parent.keyPressed();
            parent.println("Key is pressed");   
            if(parent.key == 'r')
                yaw++;
            else
                yaw--;
    
        }
    }
    /// ------------------------------------------- end of Flyer class --------------------------------
    

    Gruß Willi

  • Hi, The menu problems is solved. There is an new version of ControlP5. Thanks to sojamo. Can anybody help me with GSVideo? I need a video capture for my Quadrocopter GUI. GSVideo doesn't works.

    if (cameras.length == 0)
      {
      println("There are no cameras available for capture.");
      exit();
      } else {
      println("Available cameras:");
      for (int i = 0; i < cameras.length; i++) {
        println(cameras[i]);   <--------- OK
      }
      cam = new GSCapture(this, 640, 480, cameras[0]);   <--- Error
      cam.start(); 
    

    Thanks for help, I´m not an expert

    P.S. My IDE is Netbeans 8.2, Processing3 and windows 10, both 64bit

  • What does the error say? You can add the error below (copy and paste).

    I am not familiar with your GSCapture class. Have you tried the Capture class as provided by the video library which you can access through Processing's library manager? Try the provided examples. On the other hand, some runnable code to reproduce your problem will be helpful. Include your import lines in your code, and also it will be helpful to know your OS and Processing version.

    Kf

  • I thought, video is no more part of Processing. But it´s works. Thanks for the tip. If my GUI complete works, i will say it.

  • Answer ✓

    Great to hear. Can I ask where did you get your initial code? Where did you get the reference to GSCapture from?

    Kf

  • edited February 2017

    1-I don't understand your first question.

    2-In this thread: https://forum.processing.org/two/discussion/2659/issues-with-the-new-version-2-1-1#latest And here: Changed

    The Video and Sound libraries are no longer included in the download (because they've grown too large) and must be installed separately. Use Sketch → Import Library → Add Library... to install either one.

    My Quadrocpter GUI works fine. All components can be simulated with the mouse.

Sign In or Register to comment.