Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

  • Unexpected identifier at new Function

    @kfrajer - Sorry I should be clearer, it was working on a hosted platform before we added a domain to the platform. We then received CORS errors and had to host the PDE file elsewhere. Somehow it's become broken in the transfer. The thing I can see broken with the interaction is that when the mouse leaves the canvas, the drawing should reset.

    Sorry guys, there is HTML and JS around this which allows for the mouse position to be correct, my bad. It does get slightly complicated though as the code below may also be referencing the second PDE we have for touchscreen devices. Here it is:

        jQuery(document).ready(function() {
            // If the browser is on a device, use the device canvas.
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                jQuery('#canvas-animation').css('display', 'none');
            } else {
                jQuery('#canvas-animation-device').css('display', 'none');
        var coordX = 0;
        var coordY = 0;
        window.onmousemove = coordHandler;
        window.ontouchstart = coordHandler;
        window.ontouchmove = coordHandler;
        var width = window.innerWidth;
        // Desktop
        if (width > '768') {
            jQuery('#canvas-animation-device').css('min-height', '400px');
            jQuery('#canvas-animation-device').css('max-height', '400px');
            var leftPosition = 30;
        // Tablet top position.
        if (width > '580' && width < '769') {
            var leftPosition = 40;
        // Mobile top position.
        if (width < '581') {
            var leftPosition = 0;
        function coordHandler(event) {
            topPosition = jQuery('#global-wrapper-cp-878fa344d768280196d58da0ded0fff9').offset().top
            switch (event.type) {
                case 'mousemove':
                    coordX = event.clientX - leftPosition;
                    coordY = event.clientY - (topPosition - window.scrollY);;
                case 'touchstart':
                case 'touchmove':
                    var firstTouch = event.touches[0];
                    coordX = firstTouch.clientX - leftPosition;
                    coordY = firstTouch.clientY - (topPosition - window.scrollY);
        window.blockMenuHeaderScroll = false;
        jQuery(window).on('touchstart', function(e)
            if (jQuery('#canvas-animation-device').length == 1)
                blockMenuHeaderScroll = true;
        jQuery(window).on('touchend', function()
            blockMenuHeaderScroll = false;
        jQuery(window).on('touchmove', function(e)
            if (blockMenuHeaderScroll)
  • Flat shading for 3D objects?

    First of all you can set flat/smooth shading in you 3D modeling tool and then export it

    Yes, koogs is right, you should run some processing exampels, so you get a feeling of it.

    I created a little scetch, ftw

     * Simpel Diffuse
     * ^;.;^
     * nabr (2018/Feb/11)
    // won't work on iphone 5, raspberry pi 2, android before 2015 or any device befor 10000 bc
    PShape s;
    PShader shdr;
    void setup() {
      size(960, 540, P3D);
      // note: running in an error missing .mlt file means we don't load/reference for textures in the obj file as relative in the link to http.
      s = loadShape("https://"+"");
      // use on local drive 
      //s = loadShape("nanosuit.obj");
      shdr=new PShader(this, new String[] {"#version 150"
        ,"in vec4 position,normal;"
        +"uniform mat4 projectionMatrix,modelviewMatrix;"
        // the key here is flat default is smooth interpolation 
        +"flat out vec3 vN;"
        +"void main() {"
        // normal matrix
        +"mat4 nrm_Mtrx = transpose(inverse(modelviewMatrix));"
        // vertex normal
        +"vN = normalize(vec3(nrm_Mtrx*vec4(,0.)).xyz);"
        +"gl_Position = projectionMatrix*modelviewMatrix*position;"
        }, new String[] {"#version 150"
          ,"flat in vec3 vN;"
          +"uniform vec3 LDir;"
          +"uniform vec3 surfaceColor;"
          +"out vec4 fragColor;"
          +"void main() {"
          // simpel diffuse
          +"float brightness = clamp( max(0., dot(vN, normalize(LDir) ) ) ,0.,1.);"
          +"fragColor.rgb = brightness * surfaceColor;"  
    void draw() {
      float dirX = (mouseX / float(width) - 0.5) * 2;
      // depends on camera setup range form -/+ 0 - 1000
      shdr.set("LDir", dirX, 1f, 3f );
      // range from 0 - 1
      translate(width*0.5f, height*0.5f+220 );
      // sphere(150);

    // output (note this gif is compressed)

        Alt Text

  • how to perform a conditional check in processing on a value from serial read from arduino


    My iPhone is destroying the „“ signs - just use normal ones: ""

  • How can I earn money with processing? Where should I search?

    To be honest, processing is more a learning and art tool. I guess no company would use it for production.

    Technically it’s a wrapper for java. Java is a more advanced programming language than processing.

    So my advice would be to use java and eclipse (see tutorials) for your hobby programming to get experience in this.

    Processing and related programming languages

    Technically processing is a wrapper for java; so in Google use Java as search word.

    The choice of the programming language to apply for depends in which field you want to work when you search for a job:

    • Java is used in banks, finances, insurance companies etc.; pretty boring imho but gives you a reliable income.

    • For web development search web development / web developer, web design and java script (html, css, js). But there are several frameworks like React.

    • For developing apps for iPhone search Swift.

    • For developing Apps for Android: Android Studio which is close to java iirc.

    There are also other fields like game development, sound effects, film studios, car development, you name it. I'd guess they use those languages, including C / C++, but also special languages and specialized environments like MAYA.

    Kinds of Employment

    Also you could work as a freelancer or as an employee or leading a company. There are also different jobs: like game designer, software architect (leading smaller teams) or programmer or testing.

    Training and courses

    Also please consider to visit a proper training course or official qualifications or even university (computer science). It will give you higher earnings and career chances in the long run. So if you'd spend two years on a training and then earn more money every month for 30 years, the two years are well spent.

    Related Links

    I already posted some links above.

    It might help to read some related articles on Wikipedia:

    Success be with you.

    Best, Chrisir

  • Space bugged in IDE

    really slow If I want more then one space.

    like on the iPhone where a double space press becomes a dot . ?

    Does a single space work? Maybe that's a kind of auto correct thing

  • Best Approach to Cross Platform Mobile Development

    Hi, I hope I am posting this question in the correct forum. My question pertains to the best approach to developing a cross platform mobile application using processing. I have used Android mode to create an app and that was fairly straightforward although I did hit some limitations by the time it got published.

    The two routes I see (naively) would be to 1) write in p5.js to get javascript and then put that code into something like React Native 2) compile to Java put the code into something like CodeNameOne. I really have no idea if this would work at all.

    I would like the app to have access to features such as GPS so that may require importing from Android/iPhone code, or it might not if it is possible to do all this from "the browser" and stick it in a wrapper.

    Any insight would be appreciated!

  • String[] is always [Ljava.lang.String;@7638c30f

    You also could make a function to return the content of the array:

    String getArrayAsText() {

    String result = „“;

    for(int i.....

    result =result + ..... + „\n“;

    return result;


    The „“ must be normal „“ but my @&€& iPhone is changing those

  • Can I export my processing file to use it on an iPad?

    There is currently no easy way of porting to iOS / iPhone / iPad -- and Processing has no plans to add iOS support last I heard.

    You could try porting to p5.js, then embed your javascript web app in an app wrapper library.

    For more, see:

  • Any news on making apps for iPhone ?

    There is currently no easy way of porting to iPhone -- and Processing has no plans to add iPhone support last I heard.

    You could try porting to p5.js, then embed your javascript web app in an app wrapper library.

  • Any news on making apps for iPhone ?

    I made an app for Android, and I'd love to port it to iPhone. Is there any way to do that ?

  • create programm for macosx (on windows)

    iOS, the iPhone operating system, is different from macOS. It is not possible to easily / automatically export to iOS. There is however an Android Mode if you wish to create apps for Android phones.

    You originally asked if you could create programs for macOS on Windows. It is possible to export for macOS, and has been for a long time -- from a Mac. (see @koogs above for warning about code signing). However it is not possible on Windows:

    An application for Mac OS X can only be exported from OS X. This is due to the complexity of how Oracle's JDK works on OS X, and the limitations of the appbundler that we use.

    Processing does not currently plan to add this feature:

  • interactive programs and other platforms

    Jeremy, hmm, I understand the issue with Processing not being the best multi-platform development tool. That is a little disappointing because I really wanted to learn Processing for doing art eventually (in a future project)... and I was hoping to gain the efficiency of combining my learning curve in doing this game with my learning curve on Processing. Pardon my ignorance, but you are saying that JS doesn't just work the same in iPhone/iPad (I assume you mean all IOS systems by "iPhone") browsers as it does in Android or Windows or macOS?

  • interactive programs and other platforms

    (And yes, the interaction model is a core part of every version of Processing. In addition to mouse and keyboard p5.js has touches[] for multitouch support.)

    However, if your goal is to write game code once and then run it on the web, Android, and iPhone, Processing is not the best tool for you right now.

    Processing is currently. "write code for the web in p5.js JavaScript, write related but different code in Android mode or deploy a JavaScript mobile app wrapper of your p5.js code using a third-party system, and write hypothetical but different (largely undocumented) code for iPhone, or just don't get it working on iPhone." If you want one build button and three targets this won't do that.

    I'm a big Processing fan, but if your goal is cross-platform mobile deployment of simple 2D games then I'd recommend one of the many popular platforms designed specifically for that:

    If your goal is to let your students edit the games they play to learn about programming then Processing and Scratch are highly relevant -- particularly in a desktop context.

  • p5 Sound -- Using the soundOut Limiter ?

    My p5 sound program works well in a computer (Safari on OS X), but has strange distortion on an iPhone. Other p5 sound programs or soundcloud music doesn't get this distortion at the same level. I was thinking of putting a limiter on the output, but can't figure out how to use it. I am using p5.sound.js v0.3.5.

  • createCapture(VIDEO) on iPhone

    Hi there, I'm playing a bit with P5.js and it's really exciting.

    My question is : i have a project (in P5.js) using createCapture() which works great on GoogleChrome desktop (at least on my laptop), works great on GoogleChrome for Android too, but seems to NOT work on GoogleChrome for iOS... (i just get a blank screen instead of my fullscreen video preview)

    Any advices about that? Is that a known behaviour or may i do something wrong ... ?


  • Is there anyway to access the camera on an iphone?

    Hi, no need to write source code in JavaScript, you can use iPhone as webcam very easily. All you need to do is to use the tools called EpocCam, WebCamera. And Android users can search for many kinds of such tools on Google Play too. The process of using them is very easy.

  • Highscores save and load.

    I am sorry, I am on holiday away from home and only on my iPhone. Therefore I cannot really help you.

    Looking at your code in your original post: does the code in itself work?

    Is the addNewScore adding a new score so that the list stays sorted?

    Did you try saveStrings (scores, "score.txt");

    or so? What happened?

    Most people here help by giving hints instead of providing full code solutions so people can find out on their own. I can understand this is frustrating at times.

    Best, Chrisir ;-)

  • Are there any phone emulator codes for P5JS?

    Basically an iphone emulator/simulator like email(not real one, fake), simple games, etc. Passcodes, youtube. Etc.

  • A bubbles visualisation for quantitative data comparison

    Thanks Lord_of_the_Galaxy. Can you let me know what exactly your setup is.

    I tested Safari on Mac OK but TBH I need to test more fully on mobile platforms like iOS. It works somewhat on my iPad and iPhone, but dragging the bubbles is an issue. Like you, I am unclear what p5.js support it here. I will look into it and report back.

  • 0,0 getting moved by a class function?


    I'm creating a "console" of random images, videos, scrolling text, and every once in a while a nike shoe, an iPhone, or a mansion streaks across the screen and snakes around randomly. Then the images, videos, and scrolling text resumes, but everything is offset, like the 0,0 coordinates have been shifted by hundreds of pixels. its so weird, and I've tried to play with pushMatrix and popMatrix, but nothing I do solves this bug.

    I tried to paste my code here, but it's a mess. what's the trick?