Loading...
Logo
Processing Forum
bfarnn's Profile
2 Posts
2 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Is this a bug? Or just a basic color math concept I'm missing?

    I have a PImage with a mask that draws correctly.
    When I change the blendMode the mask disappears, except for ADD.
    This holds true when I'm using P2D, P3D, and even when the PImage is mapped onto 3D geometry.

    Is there any way to combine masks and blendingModes?

    Thanks,
    --David

    Here's my code.  I've used loadImage, but it works the same way with generated PImages:
    1. PImage image, mask;
      boolean bMask = false;
       
      void setup() {
        size(800, 800, P2D);
        image = loadImage("fibers.jpg");
        mask = loadImage("zebra.jpg");
      }

      void draw() {
        background(128);
        blendMode(ADD);
        image(image, 0, 0);
      }

      void keyPressed()
        {
            if(key == 'm') {
                if(!bMask) {
                  image.mask(mask);
                  bMask = true;
                  print(bMask);
                }
                else {
                    image = loadImage("fibers.jpg");
                    bMask = false;
                    print(bMask);
                }
            }

        }
    Hi all,

    I'm working on what should be a simple sketch, but I've run into a brick wall.
    I have a scene made of several OBJ files representing several lamp objects, with simple cone shapes representing their light beams.  I need to be able to set their color and intensity, to use a gradient bitmap as a transparency mask (which makes a nice falloff effect) - but I can't figure out how to do any of that for PShapes made of imported .obj files.

    The problem I'm having is that all of the normal operations like tint() or texture() require that they be called in between the beginShape() and endShape() operations -- but for imported OBJ files there's only loadShape(), which happens all at once.

    I've also tried using the SaitoOBJLoader library, which is supposed to handle that kind of thing, but its texture operators don't seem to work in Processing 2.0

    Am I missing something obvious?

    Thanks,
    --David

    Here's an example of a nonworking scene.  It runs, but gives me the errors:
    tint() can only be called between beginShape() and endShape()
    texture() can only be called between beginShape() and endShape()

    1. PShape s;
      PImage tex;

      void setup() {
        size(800, 600, P3D);
        s = loadShape("B03.obj");
        tex = loadImage("lightGrad.jpg");
        s.tint(255,0,0);
        s.texture(tex);

      }

      void draw() {
        background(204);
        translate(width/2, height/2);
        shape(s, 0, 0);
      }