
want smooth text movement
Posted Thursday, 17 September, 2009 - 08:45 by avogatro inopentk 9.9.2b
OS archlinux 32bit 2.6.31
driver nvidia 190 beta
I have problem to move a textprinter with a constant speed.
Vsync is on,
and i use timedelta to control the speed.
long timestamp = Stopwatch.GetTimestamp();
long timedelta = timestamp-last_timestamp;
result is not very good, every sec it make very big movement.
speed is just not constant.
any advise?


Comments
Re: want smooth text movement
In my experience, large hiccups like this are usually caused by the garbage collector. Try printing the collection count (System.GC.CollectionCount) - does it increase whenever you see a hiccup?
There are two general approaches to optimize GC performance:
You can pick one of the two approaches but not mix them together. Note that Mono does not employ a generational garbage collector at this time, which means that the second approach is difficult to implement - if not impossible. A new GC is expected to land on Mono 2.8 but that is at least half a year away.
In general:
TextPrinterOptions.NoCache). This is unavoidable for two reasons: (a) dynamic strings are (by definition!) dynamic (you allocate memory whenever you callobject.ToString()); (b) the TextPrinter tries to work around a number of GDI+ bugs by splitting strings on newline characters. Static strings are cached and don't suffer from this issue.Even with thisn limitations, I've been able to get a steady 120fps for stereoscopic rendering (where a single hiccup will cause nausea - speaking from experience!) It's not impossible to have a steady framerate - the trick is to work with the limitations in mind.