texture on curveVertex - problem

edited June 2015 in Library Questions

Hi Processing Forum,

I am working on a graphic and tried to add a structure, what is not working. Does anybody has an advice for me? Thanks a lot.

Markus

import ddf.minim.*; import processing.pdf.*; PImage img;

boolean record;

Minim minim; AudioInput input;

void setup() {

size(displayWidth, displayHeight, P3D); minim = new Minim (this); input = minim.getLineIn (Minim.STEREO, 512); noCursor(); img = loadImage("bild.jpg"); }

void draw() {

if(record){ beginRaw(PDF, "output.pdf"); }

float dim = input.mix.level () * width; translate(width/2, height/2, 0);

pushMatrix(); scale(0.9);

rotateX(PI/2); rotateZ(-PI/10);

beginShape(); texture(img); background(19,19,19);

smooth();

//stroke(255,175,0); stroke(255); strokeWeight(1.8);

scale(0.9); smooth();

rotateX(frameCount/700.0); rotateY(frameCount/600.0); rotateZ(frameCount/200.0);

curveVertex( mouseX, 320, -120); curveVertex(-250, -dim, -mouseX); curveVertex( -mouseY, -190, mouseX);

curveVertex(-260, -dim, mouseX); curveVertex(-dim, -190, -210); curveVertex( mouseX, -mouseY, dim);

curveVertex(-160, -mouseX, -290); curveVertex(-dim, dim, -210); curveVertex( 100, 140, dim);

curveVertex(-mouseY, mouseX, -390); curveVertex(-dim, dim, -210); curveVertex( mouseY, 240, dim);

curveVertex( 120, -220, mouseX); curveVertex( 290, dim, dim); curveVertex( dim, dim, mouseY);

fill(255);

curveVertex(mouseX, 220, -150); curveVertex(-dim, 110, dim); curveVertex( -mouseY, -150, mouseY);

curveVertex( mouseX, 220, -dim); curveVertex(-350, -dim, -220); curveVertex( mouseX, 210, -mouseX);

curveVertex(mouseX, dim, -200); curveVertex(-110, dim, mouseY); curveVertex( 230, dim, -mouseY);

curveVertex(340, dim, -325); curveVertex(mouseY, dim, -135); curveVertex( -dim, -mouseY, mouseY); endShape(); popMatrix();

pushMatrix(); fill(19,19,19); noStroke(); rectMode(CENTER); //rect(0,0,500,500); popMatrix();

if (record) { endRaw(); record = false; }

endShape(CLOSE);

}

//boolean sketchFullScreen() { //return true; //}

void keyPressed() { if (key == 'r') { record = true; } }

Answers

  • So I took what you posted and cut out all the bits that didn't feel like they needed to be there, and I got this:

    void setup() {
      size(600,600, P3D); 
    }
    
    void draw() {
      float dim = map(mouseY,0,height,0,width);
      translate(width/2, height/2, 0);
      pushMatrix(); 
      scale(0.9);
      rotateX(PI/2); 
      rotateZ(-PI/10);
      fill(19, 19, 19); 
      beginShape(); 
      background(19, 19, 19);
      smooth();
      stroke(255); 
      strokeWeight(1.8);
      scale(0.9); 
      smooth();
      rotateX(frameCount/700.0); 
      rotateY(frameCount/600.0); 
      rotateZ(frameCount/200.0);
      curveVertex( mouseX, 320, -120); 
      curveVertex(-250, -dim, -mouseX); 
      curveVertex( -mouseY, -190, mouseX);
      curveVertex(-260, -dim, mouseX); 
      curveVertex(-dim, -190, -210); 
      curveVertex( mouseX, -mouseY, dim);
      curveVertex(-160, -mouseX, -290); 
      curveVertex(-dim, dim, -210); 
      curveVertex( 100, 140, dim);
      curveVertex(-mouseY, mouseX, -390); 
      curveVertex(-dim, dim, -210); 
      curveVertex( mouseY, 240, dim);
      curveVertex( 120, -220, mouseX); 
      curveVertex( 290, dim, dim); 
      curveVertex( dim, dim, mouseY);
      fill(255);
      curveVertex(mouseX, 220, -150); 
      curveVertex(-dim, 110, dim); 
      curveVertex( -mouseY, -150, mouseY);
      curveVertex( mouseX, 220, -dim); 
      curveVertex(-350, -dim, -220); 
      curveVertex( mouseX, 210, -mouseX);
      curveVertex(mouseX, dim, -200); 
      curveVertex(-110, dim, mouseY); 
      curveVertex( 230, dim, -mouseY);
      curveVertex(340, dim, -325); 
      curveVertex(mouseY, dim, -135); 
      curveVertex( -dim, -mouseY, mouseY); 
      endShape(); 
      popMatrix();
    }
    

    Now, is that sort of what you wanted? If not, what did you want?

  • thanks for your answer. I want it like that but with a texture from the image called bild.jpg. In the code I posted, I added a texture how they describe it here: (https://processing.org/reference/texture_.html)

    And I don't understand why its not working. Do you know?

Sign In or Register to comment.