updatePixels()
Image / PixelsDescription
Updates the display window with the data in the pixels[] array.
Syntax
void updatePixels()
Parameters
None
Returns
voidRelated
Under the Hood
From Processing.h:
void updatePixels() { dirty = true; }
void updatePixels();
Under the Hood
From Processing.cpp:
void PApplet::updatePixels() {
int total = winWidth * winHeight;
std::vector<unsigned char> rgba(total * 4);
for (int i = 0; i < total; i++) {
rgba[i*4 + 0] = (pixels[i] >> 16) & 0xFF; // R
rgba[i*4 + 1] = (pixels[i] >> 8) & 0xFF; // G
rgba[i*4 + 2] = pixels[i] & 0xFF; // B
rgba[i*4 + 3] = (pixels[i] >> 24) & 0xFF; // A
}
glDrawPixels(winWidth, winHeight, GL_RGBA, GL_UNSIGNED_BYTE, rgba.data());
}