We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › everything drawn before just dissapears on noFill(
Page Index Toggle Pages: 1
everything drawn before just dissapears on noFill( (Read 282 times)
everything drawn before just dissapears on noFill(
May 13th, 2009, 11:59am
 
prob OPENGL what is causing the problem or maybe the hint.

anyway I use now fill(255, 0) as a solution but I thought maybe someone know what is causing it and if I should report as a bug or not?

edit:

o yeah it kepps hanging when I use curve, anyone know why that is?

   drawPoint(out.pixels, 190, 19, h*2, w*2, 255, 5, "curve");//colorArray, x, y, width, height, depth, dotSize, mode


Code:
import processing.opengl.*;
import processing.video.*;

PrintWriter output;

PFont LG10, LG10bold;

Capture cam1;
//Capture cam2;


int w = 320, h = 240;//cam width / heigth

PImage out = new PImage(h,w); //makes out a standing picture



void setup() {
 try {
   quicktime.QTSession.open();
 }
 catch (quicktime.QTException qte) {
   qte.printStackTrace();
 }
 size(800, 800, OPENGL);

 output = createWriter("output.txt");


 //  LG10 = loadFont("LetterGothicStd-10.vlw");
 //  LG10bold = loadFont("LetterGothicStd-Bold-10.vlw");
 //  textFont(LG10bold);
 fill(0); //black

 String[] devices = Capture.list();
 //println(devices);

 cam1 = new Capture(this, w, h, devices[3]); //logitech!!
 //cam2 = new Capture(this, w, h, devices[2]);

 //cam1.settings();

}


void draw() {
 if (cam1.available() == true) {
   int tmr = millis();
   background(255);

   cam1.read();

   image(cam1, 10, 20, w/2, h/2);


   /*
    cam1.filter(THRESHOLD, 0.82);
    detectBlobs(cam1, color(255,255,255));
    removeSmallBlobs(10); // >= 10 pixels keep.
    calcBlobCentres();
    showBlobs();
    listBlobs();
    */

   out.pixels = sort(cam1.pixels); //easy sort for now
   //out.pixels = sortArray(cam1.pixels, 0);
   
   out.updatePixels();

   image(out, 190, 19, h*2, w*2);

   noFill();
   //fill(255, 0);
   //mode: point/line/curve
   drawPoint(out.pixels, 190, 19, h*2, w*2, 255, 5, "line");//colorArray, x, y, width, height, depth, dotSize, mode
 

   if ((frameCount % 50) == 0){
// saveFrame();
   }

   println("milliseconds: " + (millis() - tmr));
   println("framerate: " + frameRate);

   // text("milliseconds: " + (millis() - tmr), 9, 205);
   // text("framerate: " + int(frameRate), 9, 225);
 }
}



//draw points on coördinates

void drawPoint(int[] colorArray,int x, int y, int outWidth, int outHeight, int outDepth, int dotSize, String mode){

 hint(DISABLE_DEPTH_TEST);

 pushMatrix();

 translate(x+(outWidth/2), y+(outHeight/2));

 rotateX( radians(mouseY));
 rotateY( radians(mouseX));

 float px, py, pz;

 strokeWeight(dotSize);

 beginShape();

 for (int i=0; i<colorArray.length; i+= 100){

   //get coördintae values
   px = red(colorArray[i]);
   py = green(colorArray[i]);
   pz = blue(colorArray[i]);

   //map values for output image size
   px = map(px, 0.0, 255.0, 0, outWidth);
   py = map(py, 0.0, 255.0, 0, outHeight);
   pz = map(pz, 0.0, 255.0, 0, outDepth);

   if (mode == "point"){
stroke(color(colorArray[i]));
point(px-(outWidth/2), py-(outHeight/2), pz);
   }
   else if (mode == "line"){
stroke(color(colorArray[i]));
vertex(px-(outWidth/2), py-(outHeight/2), pz);
   }
   else if (mode == "curve"){
stroke(color(colorArray[i]));
curveVertex(px-(outWidth/2), py-(outHeight/2), pz);
   }

 }

 endShape();

 popMatrix();

 hint(ENABLE_DEPTH_TEST);
}

Page Index Toggle Pages: 1