   bugs of mouse movement trace at fullscreen mode
  I got a problem at my project.The problem is cant tracing the mouse cursor point in real time.to reproduce this problem,you can simply do this:open directx sample browser,choose direct3d 9 catagory,install SimpleSample.Add the code below in the render() function.POINT p,p1;::GetCursorPos(&p);::ScreenToClient(::DXUTGetHWND(),&p);::g_SampleUI.GetLocation(p1);p.x-=p1.x;p.y-=p1.y;RECT rc = {p.x,p.y,p.x+100,p.y+100};g_SampleUI.DrawRect(&rc,0xffffffff);the code draw a white square at where the cursor point is.on window mode,it's OK.but on full screen mode you can find it's not synchronized.the white square is obviously slower than the cursor point.How can I fix this problem?   
  It's probably because the driver buffers 3 or so frames. If you hide the cursor, and draw one for yourself, it probably won't be a long enough delay to be noticeable. If it is, go into your graphics card control panel and change the settings.I have a Geforce card and in the Nvidia control panel it's under 'Manage 3D settings' and 'Maximum pre-rendered frames'. There is probably something similar for ATI.   ;  If your application is running at 60fps, your cursor is going to be lagging behind by at least 1 frame, or 16ms. Quite often it'll be much higher than that due to buffering and the like. That 16+ms is what's causing your rendered (or "software") cursor to lag behind. The Windows (or "hardware") cursor is updated with hardware acceleration, and at some obscenely high rate (hundreds of hz), so it will always feel much more responsive.   ;  thank you for your hints.Now I know the reason is my fps is too low,the simplest way to solve this problem is turn the vertical sync off.like this:DXUTD3D9DeviceSettings::pp.PresentationInterval =  D3DPRESENT_INTERVAL_IMMEDIATE;It works!but It made my cpu usage jump to 100% which is unacceptable.as I know,some hardware can't work on 100% level for a long time,it will cause various problems.To draw a emulated cursor is another way,but I will have to write the .ani load function all by myself.any other idea?   ;Quote:Original post by enchantedthank you for your hints.Now I know the reason is my fps is too low,the simplest way to solve this problem is turn the vertical sync off.like this:DXUTD3D9DeviceSettings::pp.PresentationInterval =  D3DPRESENT_INTERVAL_IMMEDIATE;That won't fix the problem, just hide it. The game is rendering faster, but the mouse is still lagging. If you run your game on some lower-spec hardware where it renders at ~60Hz, you'll just see the lag again.Quote:Original post by enchantedIt works!but It made my cpu usage jump to 100% which is unacceptable.as I know,some hardware can't work on 100% level for a long time,it will cause various problems.There's no problem with using 100% of the CPU so long as it's justified. For a game, that's perfectly acceptable, but if you're writing a word processor, using 100% of the CPU probably isn't a good idea.Quote:Original post by enchantedTo draw a emulated cursor is another way,but I will have to write the .ani load function all by myself.any other idea?The best way is to use a hardware cursor - if you need the in-game cursor to be as responsive as the real cursor, I'd go for that. What makes you think you need to write a .ani loading function? What's wrong with LoadCursor?   ;  hi erik!I can load .ani by loadCursor function.but how can i convert HCURSOR to a texture object?You can have a look at DXUTSetD3D9DeviceCursor function.dx only use loadcursor to load the bits in memory, you still have to do most of the work by yourself , directx sdk didn't afford a way to make .ani file work.This is why I'm hesitated.   ;Quote:Original post by enchantedhi erik!I can load .ani by loadCursor function.but how can i convert HCURSOR to a texture object?You can have a look at DXUTSetD3D9DeviceCursor function.dx only use loadcursor to load the bits in memory, you still have to do most of the work by yourself , directx sdk didn't afford a way to make .ani file work.This is why I'm hesitated.You don't have to use a D3D surface as far as I know - you can use a normal Win32 cursor in fullscreen mode.   ;  if I use a HCURSOR object in windows,the problem is rewind to the start.   