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.
IndexDiscussionEvents,  Publications,  Opportunities › Free-form throwdown
Page Index Toggle Pages: 1
Free-form throwdown (Read 2180 times)
Free-form throwdown
Jan 14th, 2009, 7:39am
 
I'm wondering if anyone wants to do some free-form collaborating?  I'm new - haven't done any 3D yet, and haven't pulled in large data sets yet (other than camera pixels)

Very informal - trade off days/weeks with the code, pass it back and forth and just see what happens?  Obviously we could not be possessive about the code whatsoever... all for fun and learning.

let me know -

cheers
Kerry
Re: Free-form throwdown
Reply #1 - Jan 14th, 2009, 10:40am
 
I'd join in, tho I too am new so I don't know how much I'd contribute, and with little time now..
Thanks for bringing this up, been thinking about it too.
Re: Free-form throwdown
Reply #2 - Jan 14th, 2009, 3:11pm
 
I'd like too. do you have an idea of what would be this about?

here is my stuff http://terreno.wordpress.com

regards.
Re: Free-form throwdown
Reply #3 - Jan 14th, 2009, 4:13pm
 
hey sounds good.  whatever you can do is fine, 1 line or 100.  

can you email me or post it here?
Re: Free-form throwdown
Reply #4 - Jan 14th, 2009, 4:24pm
 
and hey samuel, no i don't have any idea of what it would be about.  i'm thinking we would start over a lot.

i took a look at your site, you've got a lot more experience than me, so i don't know how entertaining it will be for you, but you're more than welcome.

have you heard of the game 'exquisite corpse'?

http://en.wikipedia.org/wiki/Exquisite_corpse

like that.

Re: Free-form throwdown
Reply #5 - Jan 16th, 2009, 6:06pm
 
no inspiration?
hope you can make something out of this, a flower with math guided petals..
Perhaps to make this work who ever starts doing something should warn here to avoid confusion..

Quote:
import processing.opengl.*;

Leaf[] leaves = {
  new Leaf(350, 400, 0, 0.5, -20, 200, 200),
  new Leaf(350, 400, 0, 0.5, 110, 200, 200),
  new Leaf(350, 400, 0, 0.5, 50, 180, 170),  
  new Leaf(350, 400, 0, 0.5, -30, 180, 170),    
  new Leaf(350, 400, 0, 0.5, -150, 190, 170),  
  new Leaf(350, 400, 0, 0.5, 200, 190, 170),  
  new Leaf(350, 400, 0, 0.5, 120, 200, 200),  
  new Leaf(350, 400, 0, 0.5, -80, 200, 200),    
};
color c = color(250, 250, 250);

void setup() {
  size(700, 700, OPENGL);
  background(0);
  stroke(c);
  rectMode(CENTER);
  fill(0);
}

void draw() {
  for (int i = 0; i < leaves.length; i++)
    leaves[i].display();  

  pushMatrix();
  translate(0, 0, -200);
  rect(350, 400, 250, 400);  
  popMatrix();
  pushMatrix();
  translate(350, 600, -200);
  rotateX(radians(90));
  rect(0, 0, 250, 500);    
  popMatrix();
}

class Leaf {
  float t;
  float x, y, cx, cy, cz, prevX, prevY, z, prevZ;
  float cosFactor;
  int sz = 200;
  float dir;
  int w, h;

  Leaf(float x, float y , float z, float fact, float direction, int w, int h) {
    cx = x;
    cy = y;
    cz = z;
    cosFactor = fact;    
    dir = direction;
    this.w = w;
    this.h = h;
    int imgW = w;
    int imgH = h*2;
  } 
  void display() {
    beginShape();
    for (t = -1; t <= 1; ) {
      x = w*sin(t)*cos(t)*log(abs(t))*0.75+abs(t)*dir;
      y = -h*pow(abs(t),0.3)*pow(cos(t),cosFactor)*exp(abs(t))+210;
      //      z = cz - abs(t)*dir; // tried to have petals twist in the z direction
      vertex(x+cx, y+cy);
      float incFactor = max(abs(t), 0.01);
      t+=0.1*incFactor;
    }
    endShape(CLOSE);  
  }
}

Re: Free-form throwdown
Reply #6 - Jan 17th, 2009, 4:59am
 
changes, a few lines here and there, hopefully not degenerating into spaghetti code.  let me know if you're confused about anything.

import processing.opengl.*;

Leaf[] leaves = {
 new Leaf(350, 400, 0, 0.5, -20, 200, 200),
 new Leaf(350, 400, 0, 0.5, 110, 200, 200),
 new Leaf(350, 400, 0, 0.5, 50, 180, 170),  
 new Leaf(350, 400, 0, 0.5, -30, 180, 170),    
 new Leaf(350, 400, 0, 0.5, -150, 190, 170),  
 new Leaf(350, 400, 0, 0.5, 200, 190, 170),  
 new Leaf(350, 400, 0, 0.5, 120, 200, 200),    
 new Leaf(350, 400, 0, 0.5, -80, 200, 200),      
};
color c = color(250, 250, 250);
int i;

void setup() {
 size(700, 700, OPENGL);
 background(0);
 rectMode(CENTER);
 noCursor();
}

void draw() {
 fill(0);
 noStroke();
 rect(width/2, height/2, width, height);

 stroke(c);
 for (i = 0; i < leaves.length; i++)
   leaves[i].display();  


 /*pushMatrix();                            
  translate(0, 0, -200);
  rect(350, 400, 250, 400);  
  popMatrix();
  pushMatrix();
  translate(350, 600, -200);
  rotateX(radians(90));
  rect(0, 0, 250, 500);    
  popMatrix();*/


}

class Leaf {
 float t;
 float x, y, cx, cy, cz, prevX, prevY, z, prevZ;
 float cosFactor;
 int sz = 200;
 float dir;
 int w, h;
 color colo;

 Leaf(float x, float y , float z, float fact, float direction, int w, int h) {
   cx = x;
   cy = y;
   cz = z;
   cosFactor = fact;    
   dir = direction;
   this.w = w;
   this.h = h;
   int imgW = w;
   int imgH = h*2;

 }
 void display() {

   pushMatrix();                                    
   translate(mouseX - (width/2), mouseY - (height/2));

   beginShape();

   fill(map(mouseX, 0, width, 0, 255),   map(mouseY, 0, height, 0, 255),   dir);  

   for (t = -1; t <= 1; ) {  
     x = w*sin(t)*cos(t)*log(abs(t))*0.75+abs(t)*dir;
     y = -h*pow(abs(t),0.3)*pow(cos(t),cosFactor)*exp(abs(t))+210;
     //      z = cz - abs(t)*dir; // tried to have petals twist in the z direction
     vertex(x + cx,y + cy);  
     float incFactor = max(abs(t), 0.01);
     t+=0.1*incFactor;

   }
   endShape(CLOSE);    

   popMatrix();                            

 }
}

Re: Free-form throwdown
Reply #7 - Jan 17th, 2009, 6:53am
 
also, I can't seem to get a functional applet of any sketch that requires the opengl library... it exports about 10 files instead of the usual 5. any suggestions?
Re: Free-form throwdown
Reply #8 - Jan 17th, 2009, 2:32pm
 
Nice, good idea about the color change. The tones kinda reminded me of the old Alice in w. cartoon Smiley
Hopefully the glowies go for that mood..was gonna give them some motion but I'm out of time..
Sorry but I have no clue about the export. I tried it here and it worked...It throws out more files because it needs a copy of the libraries used in the sketch, that's all I know

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;


Leaf[] leaves = {
 new Leaf(350, 400, 0, 0.5, -20, 200, 200),
 new Leaf(350, 400, 0, 0.5, 110, 200, 200),
 new Leaf(350, 400, 0, 0.5, 50, 180, 170),  
 new Leaf(350, 400, 0, 0.5, -30, 180, 170),    
 new Leaf(350, 400, 0, 0.5, -150, 190, 170),  
 new Leaf(350, 400, 0, 0.5, 200, 190, 170),  
 new Leaf(350, 400, 0, 0.5, 120, 200, 200),    
 new Leaf(350, 400, 0, 0.5, -80, 200, 200),  
};
color c = color(250, 250, 250);
int i;

void setup() {
 size(700, 700, OPENGL);
 colorMode(RGB, 255, 255, 255, 100);  
 rectMode(CENTER);
 imageMode(CENTER);  
 noCursor();
 pgl = (PGraphicsOpenGL)g;
 gl = pgl.beginGL();
 
 glowies = new Glowy[0];
 int numberOfGlowies = 42;
 for (int i = 0; i < numberOfGlowies; i++)
   glowies = (Glowy[])append(glowies, new Glowy());
}

Glowy[] glowies;

void draw() {
 fill(0, 50);
 noStroke();
 rect(width/2, height/2, width, height);
 stroke(c);

 pgl.beginGL();
 gl.glDisable(GL.GL_DEPTH_TEST);
 gl.glEnable(GL.GL_BLEND);
 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
 pgl.endGL();
 
 for (i = 0; i < glowies.length; i++)
   glowies[i].display();

 pgl.beginGL();
 gl.glEnable(GL.GL_DEPTH_TEST);
 gl.glDisable(GL.GL_BLEND);
 pgl.endGL();

 for (i = 0; i < leaves.length; i++)
   leaves[i].display();

}

class Glowy {
 PGraphics orb;
 int orbR; // orb radius
 int posX, posY;
 Glowy() {
   orbR = 80;
   orb = createGraphics(orbR, orbR, JAVA2D);
   orb.beginDraw();
   orb.smooth();
   orb.background(255, 0);
   orb.colorMode(RGB, 255, 255, 255, 100);
   orb.noStroke();
   orb.fill(169, 169, 169, 4);
   orb.ellipse(orbR/2, orbR/2, orbR, orbR);
   orb.fill(15, 100, 200, 70);
   orb.ellipse(orbR/2, orbR/2, orbR/6, orbR/6);  
   orb.endDraw();
   posX = (int)random(0, width);
   posY = (int)random(0, height-300);
 }  
 void display() {
   image(orb, posX, posY, 20, 20);  
 }
}

class Leaf {
 float t;
 float x, y, cx, cy, cz, prevX, prevY, z, prevZ;
 float cosFactor;
 int sz = 200;
 float dir;
 int w, h;
 color colo;

 Leaf(float x, float y , float z, float fact, float direction, int w, int h) {
   cx = x;
   cy = y;
   cz = z;
   cosFactor = fact;    
   dir = direction;
   this.w = w;
   this.h = h;
   int imgW = w;
   int imgH = h*2;

 }  
 void display() {

   pushMatrix();      
   translate(mouseX - (width/2), mouseY - (height/2));

   beginShape();

   fill(map(mouseX, 0, width, 0, 255),   map(mouseY, 0, height, 0, 255),   abs(dir));    

   for (t = -1; t <= 1; ) {  
     x = w*sin(t)*cos(t)*log(abs(t))*0.75+abs(t)*dir;
     y = -h*pow(abs(t),0.3)*pow(cos(t),cosFactor)*exp(abs(t))+210;
     // z = cz - abs(t)*dir; // tried to have petals twist in the z direction
     vertex(x + cx,y + cy);  
     float incFactor = max(abs(t), 0.01);
     t+=0.1*incFactor;

   }
   endShape(CLOSE);    

   popMatrix();          

 }
}



Re: Free-form throwdown
Reply #9 - Jan 20th, 2009, 8:04am
 
Hey I'm back with a dysfunctional sketch.  I tried to make an image filter with your glowies, but am having trouble getting it working.  
I think the problem is just the way I'm calling them in draw().  They are taking forever to display.
any ideas?
replace my 'buffalo' with any image.



import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

PImage buffalo;
color c;

void setup(){
 size(500, 400, OPENGL);

 colorMode(RGB, 255, 255, 255, 100);  

 pgl = (PGraphicsOpenGL)g;
 gl = pgl.beginGL();

 buffalo = requestImage("buffalo.jpg");
 imageMode(CENTER);  
}

void draw(){    

 if (buffalo.width == 0) {
 }
 else if (buffalo.width == -1) {
 }
 else {

   pgl.beginGL();
   gl.glDisable(GL.GL_DEPTH_TEST);
   gl.glEnable(GL.GL_BLEND);
   gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
   pgl.endGL();

   for(int x = 0; x < buffalo.width-1; x+=5){
     for(int y= 0; y < buffalo.height-1; y+=5){

       if( (abs(brightness(buffalo.pixels[(y)*buffalo.width+x])))  < 80){

         Glowy glowy = new Glowy(x, y);
         glowy.display();
       }

     }
   }
 }

}

class Glowy {
 PGraphics orb;
 int orbR; // orb radius
 int posX, posY;
 Glowy(int x, int y) {
   orbR = 80;
   orb = createGraphics(orbR, orbR, JAVA2D);
   orb.beginDraw();
   //orb.smooth();
   orb.background(255, 0);
   orb.colorMode(RGB, 255, 255, 255, 100);  
   orb.noStroke();
   orb.fill(169, 169, 169, 4);
   orb.ellipse(orbR/2, orbR/2, orbR, orbR);
   orb.fill(15, 100, 200, 70);
   orb.ellipse(orbR/2, orbR/2, orbR/6, orbR/6);  
   orb.endDraw();
   posX = x;
   posY = y;
 }  
 void display() {
   image(orb, posX, posY, 20, 20);  
 }
}
Re: Free-form throwdown
Reply #10 - Jan 21st, 2009, 2:12pm
 
Hey, the problem was creating a new one on each draw, plus a little problem with the step size, x and y. 5 is a little too small and the number of glowies required gets a bit big, at least over here I get an error due to low memory.
Good idea.. Keep it going. Now to add some colors to the glowies..Like this we only get shape but no shading..

Cheers

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

PImage buffalo;
Glowy[] glowies = new Glowy[0];
color c;

void setup(){
 size(500, 400, OPENGL);
 colorMode(RGB, 255, 255, 255, 100);  
 pgl = (PGraphicsOpenGL)g;
 gl = pgl.beginGL();
 buffalo = loadImage("one.jpg");
 imageMode(CENTER);  
 for(int x = 0; x < buffalo.width-1; x+=15){
   for(int y= 0; y < buffalo.height-1; y+=15){
     if( (abs(brightness(buffalo.pixels[(y)*buffalo.width+x])))  < 80){
       Glowy glowy = new Glowy(x, y);
       glowies = (Glowy[])append(glowies, glowy);
     }
   }
 }
}

void draw(){      
 background(0);
 if (buffalo.width == 0) {
 }  
 else if (buffalo.width == -1) {
 }  
 else {
   pgl.beginGL();
   gl.glDisable(GL.GL_DEPTH_TEST);
   gl.glEnable(GL.GL_BLEND);
   gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
   pgl.endGL();  
   for (int i = 0; i < glowies.length; i++)
     glowies[i].display();
 }

}

class Glowy {
 PGraphics orb;
 int orbR; // orb radius
 int posX, posY;
 Glowy(int x, int y) {
   orbR = 80;
   orb = createGraphics(orbR, orbR, JAVA2D);
   orb.beginDraw();
   orb.smooth();
   orb.background(255, 0);
   orb.colorMode(RGB, 255, 255, 255, 100);  
   orb.noStroke();
   orb.fill(169, 169, 169, 4);
   orb.ellipse(orbR/2, orbR/2, orbR, orbR);
   orb.fill(15, 100, 200, 70);
   orb.ellipse(orbR/2, orbR/2, orbR/6, orbR/6);  
   orb.endDraw();
   posX = x;
   posY = y;
 }  
 void display() {
   image(orb, posX, posY, 20, 20);  
 }
}

Re: Free-form throwdown
Reply #11 - Jan 22nd, 2009, 8:02am
 
Hey awesome, thanks.  looks good.  nothing to add yet, but if you're feeling really generous, here's the error message i get in my console when i try to open my exported applet:


Exception in thread "main" java.lang.NoClassDefFoundError: processing/core/PApplet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at

etc etc etc...

i'm running OSX, java is working on my puter, all the libraries are in the sketch folder...

any ideas?
Page Index Toggle Pages: 1