Why does my damaged buffer appear in pieces of 8x8 pixels?

Recently, I have been working on / Java / JOGL processing, in which I draw to the off-screen buffer. When I run the program, I see a beautiful cross (see image below).

I assume that this is the remaining data in the address spaces of the buffer since the last time the program was run. The smallest square pieces are 8x8 pixels. Large pieces appear to alternate between 8x8px squares in 4x4 metachunks, as well as tiled 4x4 squares in überchunks. I am on a 64-bit operating system.

Can someone explain to me why I see this smoothed image in the init program? Have I almost answered my question? (Mostly just curious about what's going on under the hood.)

EDIT: An enlarged version of the image has been added since SO does not have any image with a mouse click to enlarge.

My glitchtastic startup screen.Zoomed-in shot of the same.

EDIT: @SuperKael requested the code. It is difficult to single out what could create this effect, since the rendering is mainly abstracted from processing the JOGL implementation. The following is an attempt to explain what is happening in my code:

The background image of the map is loaded as a PImage :

 PImage backgroundImage = pApplet.loadImage(pathToImage); 

The buffer for the content to be drawn on top of this background image is initialized:

 PGraphics foregroundBuffer = pApplet.createGraphics(w, h, PApplet.OPENGL); 

Loading foreground images for rendering in the buffer:

 for (String path : foregroundImagePaths) { pApplet.loadImage(path); } 

In my main draw() loop, a background image is drawn, other images are pulled into the buffer, then the buffer is drawn:

 pApplet.image(backgroundImage, 0, 0); foregroundBuffer.blendMode(PApplet.ADD); for (PImage foregroundImage : foregroundImages) { foregroundBuffer.image(foregroundImage); } pApplet.image(foregroundBuffer, 0, 0); 

Smoothed images appear only briefly when the application starts. I believe that the foregroundBuffer can be drawn on the screen before proper initialization and that other operations block the main thread long enough to see the initialization fail.

This is a thumbnail of the background image: enter image description here

+4
source share
1 answer

One possible explanation: when your program starts the memory used by your buffer, it is probably "uninitialized." This means that it contains everything that was physically left there by its previous user (task, process, system, driver, whatever).

The memory there is controlled by a system of pieces with a minimum size, usually some bytes are used to chain blocks and record the length of the block, then there is actual data.

When you show the “uninitialized” buffer, you actually show these pieces (interpreting the left link / size / content as image data), and when there is a sequence of rather small fragments, they create this effect.

0
source

All Articles