I really, really, appreciate the fast answer, thanks!
But does this works on a specific window only or can I capture everything I have on the screen?
I'll try to give you a bit of context.
I have created a PC Ambilight project.
This project basically capture the screen image, and sends an encoded version of the "screen colors" to a microcontroller that display that colors to a led strip.
This are the project involved for the purpose
https://github.com/sblantipodi/pc_ambilighthttps://github.com/sblantipodi/JavaFastScreenCaptureand this the result:
https://www.youtube.com/watch?v=68pnR5HMCTUAs you can see I use the AWT Robot Java class to capture the screen, it works well and with the right numbers of threads it works even fast.
The problem is that the robot class creates "some stutter" on slow CPUs and it's really CPU intensive if pushed that hard with threads.
Is there a way to get a simple screenshot using JOCL and the GPU and put that screenshot in a BufferedImage?