+GLbyte sink[shadeWidth * shadeHeight * 4];
+
+void inline mapPixelRead(int pboBuf, int metaball) {
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, pboBufs[pboBuf]);
+ GLubyte *src = (GLubyte *)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, 4 * sizeof(GLubyte),
+ GL_MAP_READ_BIT);
+ vec4 pixel = vec4(src[0], src[1], src[2], src[3]) / vec4(255.f);
+ glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
+
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+
+ // Multiply the pixel value by the sunlight color.
+ pixel *= envColors[envColorIdx][0];
+
+ // Store the color for the previous set of pixels
+ metaballs[metaball].col = pixel;
+}
+