More timing problems (bug in DX drivers?)

BlitzMax Forums/BlitzMax Programming/More timing problems (bug in DX drivers?)

Pete Rigz(Posted 2007) [#1]
Hello, made a start on a little top down game and after reading some of the excellent posts here on timing code I implemented HrdNutz timing code (thank you very much for that!). Both in windowed mode and full screen with either flip 0 or 1 it was silky smooth, didn't even notice the tiniest of glitches. Great.

So then I started on a little particle engine for it in a separate program, implemented the same timing code and it jittered all over the place, seemed ok in full screen but in windowed with flip 1 it was crazy. I couldn't understand why the game engine I was doing with the same timing code was so smooth in all modes but this wasn't.

Anyway, after process of elimination I reduced both main loops to just this:

Graphics 800,600
While Not KeyDown(KEY_ESCAPE)
	Cls
	
	dt = MilliSecs() - t
	t = MilliSecs()

	DrawText dt,0,0

	Flip 1
Wend


When I ran this on the particle side of things dt flicks between 0, 16 and 17, so i figured it must be swings from 0 to 16/17 that's causing those jitters. The game code however simply flickered between 16/17, but why? Turns out that at some point I'd put

SetGraphicsDriver GLMax2DDriver()


in the game code and that was smoothing things out. So for some reason the dx drivers (which i assume are set as default) seem to not bother waiting for a sync every other frame. Maybe just my PC? It's Vista, maybe a dx 10 issue? I dunno, I've had enough confusion for now so I'm happy to stick with the GL drivers :)

Bizarrely, putting a delay 1 before the flip goes some way to smoothing things out.


dmaz(Posted 2007) [#2]
opengl has just been the best hands down on any "XP" machine that I've tried. Even laptops with old S3 chips run opengl better and much faster than BlitzMax's DX implementation (again in XP). that's just my experience though.


MGE(Posted 2007) [#3]
If you're not using delta timing you will notice the jitters heavily if your render loop misses a vsync or 2. Also, check your DirectX dirvers to make sure VSYNC is not disabled, if it is, nothing via software can change it, you would need to change it on your driver settings.