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 & HelpPrograms › Bug or just me
Page Index Toggle Pages: 1
Bug or just me? (Read 625 times)
Bug or just me?
Jul 31st, 2007, 1:05am
 
I did or sketch that explodes an image in to definable pixels(or I modified an example). Fx, this sketch devides the image into small plusses. image: http://i210.photobucket.com/albums/bb264/Snooze_/Face.jpg.
My problem is that all the small images(plusses/pixels), which are gifs, loose their transparency in some parts of the program, while they are maintained in most parts. I dont get it.. someone?


import processing.opengl.*;

PImage pixel;
PImage img;       // The source image
int cellsize = 11; // Dimensions of each cell in the grid
int COLS, ROWS;   // Number of columns and rows in our system
void setup()
{
 size(530, 600, OPENGL);
 img = loadImage("face.jpg");     // Load the image
 pixel = loadImage("pixel.gif");
 COLS = 486/cellsize;            // Calculate # of columns
 ROWS = 552/cellsize;          
 colorMode(RGB,255,255,255,100);   // Setting the colormode
}
void draw()
{


 background(0);
 // Begin loop for columns
 for ( int i = 1; i < COLS;i=i+1) {
   // Begin loop for rows
   for ( int j = 1 ; j < ROWS;j++) {
     int x = i*cellsize + cellsize/2; // x position
     int y = j*cellsize + cellsize/2; // y position
     int loc = x + y*486;           // Pixel array location. y*width
     color c = img.pixels[loc];       // Grab the color
     // Calculate a z position as a function of mouseX and pixel brightness
     float z = 0.78 * brightness(img.pixels[loc]) - 100.0f;
     // Translate to the location, set fill and stroke, and draw the rect
     pushMatrix();
     // strokeWeight(#); (only for boxes etc.)
     noFill();
     noStroke();
     // The location of the picture
     translate(x,y,z);
     tint(c);
     scale(0.5);
     image(pixel,0,0);
     popMatrix();

   }

 }
}

Re: Bug or just me?
Reply #1 - Jul 31st, 2007, 2:38pm
 
see the sixth item under "common issues (not bugs)" on the troubleshooting page (also available from the help menu -> troubleshooting).
http://processing.org/reference/troubleshooting/index.html#opengl
it's not really a bug but something we need to fix anyway:
http://dev.processing.org/bugs/show_bug.cgi?id=176
Re: Bug or just me?
Reply #2 - Aug 1st, 2007, 11:30am
 
okay.. how do I do the back - front stuff? which object to I use?

Slm
Re: Bug or just me?
Reply #3 - Aug 1st, 2007, 11:44am
 
you need to sort your objects by z order and render them from back to front.. the ones far from camera should be drawn first.. also one idea is to render opaque and transparent objects/faces seperately.

check the website fry mentions.. get some sort algorithm and go from there. there are a few and they all should do depending on what u're trying to achieve
Page Index Toggle Pages: 1