|
I am getting an error when ever I call array().
Code segment dealing with this:
ByteBuffer _frame = Buffers.newDirectByteBuffer( 4 * Main.gui.glCanvas.getWidth() * Main.gui.glCanvas.getHeight() );
System.out.println( "Num Pixels " + Main.width * Main.height );
gl.glReadPixels(
0,
0,
Main.gui.glCanvas.getWidth(),
Main.gui.glCanvas.getHeight(),
GL3.GL_RGB,
GL3.GL_BYTE,
_frame
);
try {
BufferedImage bi = ImageIO.read( new ByteArrayInputStream( _frame.array() ) ); // Error here!
ImageIO.write( bi, "png", new File( "Slices/slicu.png" ) );
} catch ( Exception e ) {
System.out.println( e.getMessage() + " @ Filler.draw()" );
e.printStackTrace();
}
|