When i use the grabScreen method it fills my byte array with -1
What am i doing wrong?
Rectangle rect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
int width = rect.width;
int height = rect.height;
int size = width * height * 4;
while (true)
{
byte[] bytes = new byte[size];
boolean success = ScreenCapture.grabScreen(displayIndex, 0, 0, width, height, bytes);
// do something with the byte array
}
When i use the grabScreen method it fills my byte array with -1
What am i doing wrong?