Is it possible to vsync animated graphics in Java in windowed or full-screen mode?
In java2d it isn’t.
In openGL (LWJGL and JOGL) you can set vsync on and off using their API’s.
It is possible. Get the monitor’s refresh rate then cap your game loop to that number.
I believe that’s all vsync is.
No it is not. It is called sync for a reason.
This is what you would get if you just cap your loop to the monitors refresh rate, which still gets you screen tearing.
| | | | | | | | | | | | |
| | | | | | | | | | | | |
vsync does this:
| | | | | | | | | | | | |
| | | | | | | | | | | | |
Ahh makes sense!
From the docs, it sounds like vsync is only possible in full screen mode. Also, using those APIs, can I procedurally create bitmaps on the fly? Each frame in my game is generated via direct pixel manipulation. Currently, I’m doing this using a BufferedImage backed by an int array.