Original Post
*Update - I believe I've solved the problem, read down a few posts* I've come to a dead end on this one and this post is a last resort. I know this topic has been posted before but the proposed solutions to my problem don't work. My problem is that the cursor in my game seems to lag. I move my mouse and then the display shows the mouse moving at a later point in time. If I do "ShowCursor( true )" the system cursor is obviously where it should be with my bitmap cursor following far behind. Here is how I've tried to fix this problem. 1) I'm calling GetCursorPos( &cursor ) one line prior to the draw call of the cursor. 2) My main loop looks like the following. NewFrame() returns TRUE if 1.0/FPS has elapsed since the last frame. while( msg.message != WM_QUIT ) { if( PeekMessage( &msg, NULL, NULL, NULL, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { if( NewFrame() ) ...Do Game Related Stuff... } } Now, having done the above two things I'm still seeing horrible cursor lag. Setting FPS to some rediculous value like 700 produces extreme lag whereas a FPS of 60 only lags the cursor a little. From the reading I've done it seems my application is GPU-limited, my CPU is calling Present more times than it should, several frames are getting buffered, and the result is mouse lag. Am I correct here? I'd like to have a not-so-laggy cursor at 60+ FPS. Ok, now to my current situation. I've read that using LockRect will allow you to test for D3DERR_WASSTILLDRAWING, and to sync the CPU with the GPU we shouldn't render until the system is done drawing. I've tried this approach and I simply can't get it to work. I've come to the conclusion that my LockRect call NEVER returns D3DERR_WASSTILLDRAWING, even if I remove the "if( NewFrame() )" condition in my main loop. What gives? Here is my LockRect code, if someone could please help me out I'd appreciate it. Render() { if( !StillDrawing() ) { device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_RGBA( 0, 0, 0, 0 ), 1.0f, 0 ); ...Draw Game-Related Stuff... device->Present( NULL, NULL, NULL, NULL ); } } BOOL StillDrawing() { LPDIRECT3DSURFACE9 s; device->CreateOffscreenPlainSurface( 1, 1, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &s, NULL ); D3DLOCKED_RECT r; return ( s->LockRect( &r, 0, D3DLOCK_DONOTWAIT ) == D3DERR_WASSTILLDRAWING ); } [Edited by - theahnfahn on December 21, 2004 2:39:41 AM]