PImage / pixels[]
              in 
             Programming Questions 
              •  
              6 months ago    
            
 
           
             Hi.
            
             
            
            
             
            
            
             
            
            
             
            
            
             
            
             
            
            
             
              
            
            
             
            
            
              
             
            
            
             
            
            
             
            
            
             
            
            
             
             
           
 
            
           
             Because of this problem: 
             redraw problem
            
            
             I want to use a pimage instead of drawing points.
            
            
             But again .. strange things happen. I expect a 500x500 picture. But it looks line the screen below.
            
            
             Here the relevant code:
            
            - PImage MapIMG = createImage(500,500,RGB);
             drawMap() ist called in the main loop.
            
            - void drawMap() {
- loadPixels();
- int counter=0;
- for (int x=0; x < MapIMG.height;x++) {
- for (int y=0; y < MapIMG.width;y++) {
- color c = color(map[x][y]);
- pixels[x + y*MapIMG.width] = c;
- }
- }
- updatePixels();
- image(MapIMG,0,0);
- }
             That's not 500*500 and always only the top of the image :-/ (screenshot only from the top of the screen)
            
            
             Again .. can't be this hard. But I don't get it. Where am I wrong?
            
            
             A bit frustrating now :-)
            
            
             Thanks
            
            
             Robert
            
             
              
              1  
            
 
            
 
 
           
 
             
 
            