hi,
i’m looking for the fastest way to get a BufferedImage from type TYPE_INT_RGB to a texture, to process the pixel data in a shader, and back to the BufferedImage.
At the moment i convert the integer values with the help of a temporary Color object to seperate float (R, G, B) values. I pass these float values over a FloatBuffer to the texture, process them with the shader and write them back to the BufferedImage. of course this is very slow.
code for the conversion from the BufferedImage to the FloatBuffer
for ( int h = 0; h < img.getHeight (); h++ ) {
for ( int w = 0; w < img.getWidth (); w++ ) {
Color temp = new Color ( img.getRGB ( w, h ) );
data.put ( temp.getRed () );
data.put ( temp.getGreen () );
data.put ( temp.getBlue () );
}
}
perhaps someone knows a faster solution…