@kooogy
I actually mentioned that lines are also slow.
@amnon.owed
The width and height of the rectangles was a mistake. I just accidently put the *i part in.
I dont think you really get what I want. It's maybe because of my explanation because I want a grid with 16X16 pixels cells. Is it really faster to draw it on a PGraphics and draw that image (can be up to 3000x3000 pixels) then to draw lines?
Edit
Lines seem to be slower so I'll try the PGraphics part.
Edit
Why does the window not show up when I use this:
- PGraphics pg;
- void setup() {
size(1280, 720);
pg = createGraphics(1280, 720,JAVA2D);
pg.beginDraw();
for (int i=0;i<width/16;i++) {
for (int j=0;i<height/16;j++) {
pg.rect(i*16, j*16, 16, 16);
}
}
pg.endDraw();
}
- void draw() {
image(pg, 10, 10);
}
And why does it show nothing when I use this:
- PGraphics pg;
- void setup() {
size(1280, 720);
pg = createGraphics(1280, 720,JAVA2D);
}
- void draw() {
pg.beginDraw();
for (int i=0;i<width/16;i++) {
for (int j=0;i<height/16;j++) {
pg.rect(i*16, j*16, 16, 16);
}
}
pg.endDraw();
image(pg, 0, 0);
}