Replacing static color with HSB

edited November 2014 in GLSL / Shaders

Hello!

I am working with a kinect and am tracking movement to draw on the program. I am trying to have the line change color by having a gradient rainbow. I have a code that works with the built in camera, but when I switch it to the kinect, it becomes green but does not change color.

At first, the code looks like: color[] userClr = new color[]{ color(255,0,0);

I then changed it to: color[] userClr = new color[]{ color (HSB, HUE, 1, 5)

Thank you!

Answers

  • Hello I am wondering have you figured this out yet?

  • Hello icekerim! Yes I did!

    There are multiple parts to my code that enabled this to work. I'm not a professional at code, but I hope this will help! Please note that there is a lot of other code that could change how this works.

    `

    static final int HUE = 1<<10, FPS = 200, TOLERANCE = 40, ALIASING = 2;
    
    void setup(){  
         colorMode(HSB, HUE, 1, 1);
               smooth(ALIASING);
               noFill();
    }
    
     void lines(ArrayList<PVector> vl, PVector p2d, int distance, int thickness) {
       int fc = frameCount;
    
      stroke (fc++ & HUE-1, 1, 10);
             noFill(); 
             strokeWeight(thickness);
    
    }
    

    `

    These are all the aspects that I'm pretty sure affects the color. I'll be posting my whole code in a second, so you can check it out if you have a kinect.

Sign In or Register to comment.