cant use set() function within my loop? - will not set all pixels
in
Programming Questions
•
1 year ago
Hello
I am working on a image to data converter for my LED-POV project, that reads in an .bmp file, and reads the colors on specified positions in the image, and warps them into a file.
But i´m stuck at the very beginning, where is simply want to display the calcuated lookup positions on the window with the set() function. But it only draws the first pixel (should be around 4096 individual pixels) to the screen. the position values are claculated properly - i have checked that with two lines, outside my loops.
As I understood in the reference, it should be possible to use the set() function in a for loop, and all individual pixels will be drawn after the loop is finshed.
anyway here is the relevant code:
I am working on a image to data converter for my LED-POV project, that reads in an .bmp file, and reads the colors on specified positions in the image, and warps them into a file.
But i´m stuck at the very beginning, where is simply want to display the calcuated lookup positions on the window with the set() function. But it only draws the first pixel (should be around 4096 individual pixels) to the screen. the position values are claculated properly - i have checked that with two lines, outside my loops.
As I understood in the reference, it should be possible to use the set() function in a for loop, and all individual pixels will be drawn after the loop is finshed.
anyway here is the relevant code:
- void draw() {
//frameRate(25); //reduce framerate
//background(255);
//image(clayer1, layerposx, layerposy);
for(int framepos = 0; framepos < 256;) {
calc_angle();
for(int ledpos = 0; ledpos < 16;) {
calc_hyp();
calc_pos();
//pixcol = get(position_x, position_y);
color black = color(0);
loadPixels();
pixels[position_y*900+position_x] = #000000;
updatePixels();
//set(position_x, position_y, black);
//stroke(255,0,0);
//line(0, position_y, 900, position_y);
//stroke(255,0,0);
//line(position_x, 0, position_x, 626);
ledpos++;
}
framepos++;
}
}
I thank you guys in advance! I am sure that there is just a rediculus problem, but i cant find it ...
1