Skip to main content
gamedev.net
🔒 Locked

DirectX Timing

Started by Armera Nov 29, 2000 at 12:35 AM 6 replies 800+ views
Original Post
Armera
Armera
Can anyone tell me or point me in a direction to help me understand high performance timers and using timing within programs. All of my programs all deal with input from the keybaord and nothing on timing. I understand d3d and dd very well but i am unable to implement anything because of this. (For example using the gamacontrol to do a fade on the primary surface taking only 4 seconds to go from a picture to black.) Thanks for any help.
It's not reverse engineering, unless you get caught.
Armera
Armera
I understand there are QueryPerformance functions to do this but i dont understand timing in general at all. I know it seems weird to know 3D programming without knowing anything about timers.
It's not reverse engineering, unless you get caught.
grasshopa55
grasshopa55
What exactly are you looking for? I think I might be able to help, but your question is a bit vague. Have you ever used a timer before? Are you just looking for ways to use timers?

Kevin =)
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com
Lethe
Lethe
This is one of those things that looks complicated, but isn't-

You use QueryPerformanceFrequency() to get the frequency, ie how many ticks per second, then whenevr you want to time somthing you call QueryPerformanceCounter() - this returns you the tick count. Note that these return some weird structures - look them up in the microsoft sdk, and you will find they are just int64's.

Anyway, an example, if you want to time how long a proccess took, in seconds, do the following-

LARGE_INTEGER StartTime; QueryPerformanceCounter(&StartTime);

// Do whatever here;

LARGE_INTEGER EndTime; QueryPerformanceCounter(&EndTime);
LARGE_INTEGER Freq; QueryPerformanceFrequency(&Freq);

double TimeTaken = (EndTime.QuadPart-StartTime.QuadPart)/(double)Freq.QuadPart;



You would probably want to avoid the above code in a game - that calculation as a slow as hell, but it shows the teqneque.
-Lethe



Edited by - Lethe on November 29, 2000 8:37:32 AM
Armera
Armera
Lethe:
Thanks! That helped me a little on understanding them. Would there be any place to maybe find some tutorials on this subject?

grasshopa55:
Yea i used windows WM_TIMER before but i heard it is unreliable for timing programs. Thats why i want to learn about high performance timers.
It's not reverse engineering, unless you get caught.
bintangku
bintangku
i''m using C++Builder4 Timer....its seems like nothing problem..and quite fast (for me).. and I used GetTickCount()
gumball
gumball
go to Witchlords site www.witchlord.com and download his first tutorial, he has a timer class which is exactly what you are looking for and you can just plug it into your programs

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.