Jump to content
  • Advertisement
Sign in to follow this  
racarate

OpenGL Basic frame timing and measurement

This topic is 624 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

Hi!  I am making an extremely simple (two mesh) visualization on Windows and I was wondering if I could just call wglSwapInterval(1) and run everything as fast as possible.  As long as I hit the 16ms budget, I am guaranteed not to drop any frames, right?

 

Related, I would like to measure my times like in X-Plane -- they have a statistic for CPU and GPU that gives millisecond counts.  Is that as simple as timing my main game loop?  Would my timer include the call to wglSwapInterval?  That would include the blocking wait, right?  Also, I don't really even know where to begin with measuring my GPU milliseconds.  Is there a function for that in OpenGL or is it all driver-specific?

 

Thanks,

Nick

Share this post


Link to post
Share on other sites
Advertisement

Is that as simple as timing my main game loop?  Would my timer include the call to wglSwapInterval?  That would include the blocking wait, right?

 Yes and yes. The swap function only blocks if necessary. It does not wait for the GPU to complete the current commands -- it only blocks if the CPU is getting to far ahead, and more than a few frames worth of commands are starting to pile up in a big queue into the GPU.

Also, I don't really even know where to begin with measuring my GPU milliseconds.  Is there a function for that in OpenGL or is it all driver-specific?

https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_timer_query.txt

Edited by Hodgman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!