Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AbsentMinded

question on my timer code...

This topic is 5446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i know there are some other posts about this type of stuff i just want to know why my code isnt working because it looks to me like it should yet it just shows me getting like a max of 72fps when i should be getting alot more since im not doing anything just making the window lol here is my class im using...all im using it for so far is to get the fps...
class Ctimer
{
	__int64 _startTime;
	__int64 _frequency;

	short	_fps;
	short	_frames;

public:
	Ctimer() {}
	~Ctimer() {}

	void init();
	void update();

	inline short getFPS() { return _fps; }
};

void Ctimer::init()
{
	QueryPerformanceFrequency((LARGE_INTEGER*)&_frequency);
	QueryPerformanceCounter((LARGE_INTEGER*)&_startTime);
}

void Ctimer::update()
{
	_frames++;

	static __int64 lastTime =_startTime;
	LARGE_INTEGER currTime;
	QueryPerformanceCounter(&currTime);

	if(currTime.QuadPart-lastTime >= _frequency)
	{
		_fps=_frames;
		_frames=0;
		lastTime = currTime.QuadPart;
	}
}

[edited by - AbsentMinded on July 26, 2003 8:00:20 AM]

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure what kind of program you are creating, I''m assuming a game but the best thing you can do is control vsynch at the startup of your program, and leave the windows setting alone. In OpenGL this is done with the WGL_EXT_swap_control extension.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!