public void post() { this.applet.loadPixels(); MatParamTexture matParamTexture = this.material.getTextureParam("ColorMap"); if (matParamTexture != null && this.abgrPixelData != null) { this.abgrPixelData.clear(); int c = 0; int w = this.applet.width; int len = this.applet.height * this.applet.width; // * if we simply put color to the buffer as follows, // * for(int i=0; i <this.applet.width*this.applet.height; i++){ // * int color = this.applet.pixels[i]; // * the image is flipped, therefore, updated as follows for (int i = 0; i < len; i += w) { for (int j = w - 1; j >= 0; j--) { int color = this.applet.pixels[len - 1 - (i + j)]; int a = (color >> 24) & 0xff; int r = (color >> 16) & 0xff; int g = (color >> 8) & 0xff; int b = color & 0xff; int abgrColor = (a << 24) | (b << 16) | (g << 8) | r; this.abgrPixelData.asIntBuffer().put(c, abgrColor); c++; } } this.appletImage.setData(this.abgrPixelData); matParamTexture.getTextureValue().setImage(this.appletImage); } }