Jump to content
  • Advertisement
Sign in to follow this  
flery

OpenGL Smooth Animation HiResTimer (Different Results OGL/DX)

This topic is 3023 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 have a problem with my animations. i am using the windows hi res timer for timing. all my animations (at least in window mode) are jerky. using a timer with a averaged timesteps (over the last 30 frames) did not help much either. now i have 2 questions: 1. When using opengl my mousemovements flood the windows messagepump of my app which totally screws up the timing. why is that only an issue with opengl and not with dx? i solved the problem changing the code:
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))	
		{
			if (msg.message==WM_QUIT)				
			{
				done=TRUE;							
			}
			else if (msg.message == WM_KEYDOWN)
			{
				...
			}
			else								
			{
				TranslateMessage(&msg);			
				DispatchMessage(&msg);			
			}
		}
else									
		{
                      ...paint...
		}
		f3::util::timer.stop();
		f3::util::timer.start();





to:
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))	
		{
			if (msg.message==WM_QUIT)				
			{
				done=TRUE;							
			}
			else if (msg.message == WM_KEYDOWN)
			{
				...
			}
			else								
			{
				TranslateMessage(&msg);			
				DispatchMessage(&msg);			
			}
		}

                      ...paint...

		f3::util::timer.stop();
		f3::util::timer.start();





but the question still stands why does the same not happen using directx? 2. question what can i do to further smooth the animation with opengl and directx? should i use another timer? my guess is that multitasking could screw up the timings. i am not using any threading but as far as i know the OS splits up the workload to both cores (Core 2 Duo CPU). greetings flery ps: i hope i picked the right forum i chose it because of question #1. the whole sourcecode is available here. update: turning off vsync helps to smooth the animation but i would like to be able to use vsync. [Edited by - flery on March 16, 2010 3:37:26 PM]

Share this post


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

  • 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!