A couple of stupid questions (about Timer's etc)

I've noticed that the people use quite different way's to measure the time in the XNA samples and in MDX altogether (I mean: some are using native Win32 functions, other System.Timers, etc.).

So what would be the best/proper way to do it in an XNA game?

My second question is even more stupid: How can I make a spining triangle with just HLSL? I'm just starting with shaders so excuse me for this question.

[424 byte] By [Zingam] at [2007-12-25]
# 1
The Game class provides timing for you. Take a look at the Game.ElapsedTime, Game.ElapsedRealTime and Game.GameTime.
MitchWalker-MSFT at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2

Sorry for resurrecting an old thread, but I have a quick question to tack onto this:

Does the Game.GameTime class use a form of the unmanaged QueryPerformanceFrequency and QueryPerformance timer functions? I did not realize that XNA had a built in timing class, so I was doing a little digging around. From one of the GameFest 2006 presentations, they mentioned that it wasn't necessarily good to use SetThreadAffinityMask, yet using it it is the only way I have seen to get the high performance timing functions to properly work on multicore machines (namely AMD). How did you guys manage to get around this, if you are using the PerformanceFrequency functions?

JoelBennett at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
This is a little old, but I found it using a search, so I'll answer it.

You can set thread affinity (say, of the main thread) on a single thread to a single core; other threads will still disperse to other cores. If all timing is done in the single thread, you're home free.

Also, I have an Athlon X2, as well as a Core Duo, and both of them appear to work without thread affinity, after I install the appropriate CPU/Chipset drivers. I haven't gone hard-core on trying to verify it, but I've run some code that asserts if time runs backwards, and it hasn't fired yet.

JonWatte at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 4

Well, that is good to hear that things seem to work fine. Perhaps I heard about an isolated case.

I am afraid the latest XNA beta has greatly distracted me (as well as a full course load at school). Thanks for the reply!

JoelBennett at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...