Vertical Retrace Sync and PXLAB

I was just considering breaking out my C++ and JNI to build a small library to allow me to call “waitForVerticalRetrace()” then it occured to me that someone might have already done this…

I found this:
http://www.uni-mannheim.de/fakul/psycho/irtel/pxlab/

Now it doesn’t look very applicable til you did through the source and find VideoSync.java which is a native interface to support vsync on windows.

I’m about to contact the author about repackaging it, could someone who knows a bit more about Direct Draw take a look at the source and see if its actually makes sense? :wink:

Kev

Oh well, here it is if anyone wants it… I’ve repackaged it up a bit and stripped out anything that wasn’t need to just do synchronisation.

http://www.newdawnsoftware.com/resources/pxsync/pxsync.zip

Contains source (Java and C) and binaries.

To wait for vertical retrace do:


VideoSync.waitForEndOfVerticalBlank();

VideoSync exists in the “de.pxlab.pxl” package. Full credit to the pxlab authors who I haven’t heard from yet. However, since its “Free Source” there shouldn’t be any problem.

I’ve added it as an optional thing to Mini Adventure (i.e. you can turn it on in the options). Seems to work fine. Mini Adventure is webstartable if anyone would like to try it out. (http://www.newdawnsoftware.com/miniad)

Kev

Windowed mode vsync? cooool :o

There it is :o

Would be great if we could have such a thing in java in general (I mean in “pure” java).

Yeah, it would be wonderful… I wouldn’t have bothered if it was going to be in 1.5, but I haven’t heard anything in that direction…

Solves one of my problems at least :slight_smile:

Kev