Jump to content
  • Advertisement

Archived

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

wannabe H4x0r

Directinput buffered mouse lags behind system cursor

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

my program uses direct3d to draw the mouse cursor and buffered input to read the mouse cursor. when i tried to detect mouse clicks on my buttons i realized that using my buffered input to update my mouse position, they were not actually the same positions as the mouse cursor that was being draw on the screen! so now when i force the mouse cursor to the location calculated using buffered inputs every frame, not only is the cursor laggy, it JUMPS. when i move it with any speed at all, the mouse cursor jumps around on its way to its destination. what is going on here??? does anybody else experience problems with buffered input??? I cant find anything wrong with the program. it''s completely generic with no gimmicks or anything. reads from a 16 item buffer, each frame runs through the buffer and adds buffered mouse offset to current location, etc.

Share this post


Link to post
Share on other sites
Advertisement
It''s not buffered input, but buffered output that causes this effect. Your video card drivers buffer up to 3 frames at a time in the render queue, so the place you''re telling the mouse cursor to render won''t be seen until about 3 frames after you set that position. When running at fairly low FPS (10-20), this effect becomes highly noticeable as mouse lag. You can try to be hackish and lock the backbuffer after every frame, which will effectively flush the buffer and make it not buffer more than 1 frame at once. The alternative is to make stuff render faster...

Share this post


Link to post
Share on other sites
but i''m maxing out my monitor refresh rate (i.e. 75 Hz), and that doesn''t explain why my mouse coordinates calculated from buffered input (after stopping any mouse movement whatsoever) is different from the coordinates of the cursor being displayed on screen (of course, unless i force the cursor into my ''real'' location, causing the aforementioned irritating jumpy and laggy mouse).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!