mouselag
BlitzMax Forums/BlitzMax Programming/mouselag
| ||
in windowed mode with heavy graphics going on (still really high framerates) the mouse will lag behind somewhat. [edit]It *does* still occur in fullscreen mode. This stuff happened with blitz3d as well if I recall. Is there a resolution? |
| ||
Ideally I want the mouse updating all the time. I force the mouse to update at a higher logic and it still lags behind. This is incorrect behaviour and baffling. |
| ||
Have you tried sticking a PollSystem or Delay in your main loop? |
| ||
Since the mouse pointer in windowed mode is managed by the desktop, probably you're not giving it enough CPU time spare to be processes, which I think is what flameduck is getting at. |
| ||
Does not lag in opengl but does in dx. |
| ||
I should be more clearer: it plays "catch up" and remembers my old movements from long ago: I don't want it to do this, I want it to only know the current mouse position. Weird eh? |
| ||
You game is calling flip to fast, happened to me too Try putting this (untested) code in you main loop Tmp=(MilliSecs()-LastTime) If Tmp<60 Then Delay 60-Tmp LastTime=MilliSecs() |
| ||
edit: doesn't help issue, sorry |
| ||
The solution would be to flush the mouse queue and only get the most recent item back. Any idea how thats done? |
| ||
Weird, no mouse lag on this:'SetGraphicsDriver GLMax2DDriver() Graphics 640,480,0,0 Repeat Cls For i = 0 To 100000 SetColor Rand(255),Rand(255),Rand(255) DrawRect Rand(0,640),Rand(0,480),10,10 Next Flip Until KeyHit(KEY_ESCAPE)If it's because you draw your own mouse pointer to the screen, I don't think it's easy to avoid. Because that will be dependant on how quickly you redraw your graphics. |
| ||
Hi, to clarify, it only affects mousex() and mousey() results. These return the absolute position of the mouse under opengl graphics but they return the position of the mouse in a drip-fed queue under dx. So under dx, I will see the mouse values play "catch up" in a queue, whereas using opengl, the mouse values returned will be the last position of the mouse. This is a clear problem with dx. |
| ||
No, Rob's rendering at 60fps+ but mousex( ) is returning old values. Don't think jerky, thing lagged. |
| ||
There is absolutely no difference between the drivers on my machine:'SetGraphicsDriver D3D7Max2DDriver() 'SetGraphicsDriver GLMax2DDriver() 'SetGraphicsDriver BufferedD3D7Max2DDriver() Graphics 640,480,0,0 Repeat Cls For i = 0 To 100000 SetColor Rand(55),Rand(55),Rand(55) DrawRect Rand(0,640),Rand(0,480),10,10 Next 'Flip SetColor 255,255,255 DrawOval MouseX()-3,MouseY()-3,5,5 Flip Until KeyHit(KEY_ESCAPE) Or AppTerminate()So it might be a driver issue, or specific to certain graphics cards? Try uncommenting the Flip before the mouse drawing to see if that makes a difference for you. |
| ||
'SetGraphicsDriver D3D7Max2DDriver() 'SetGraphicsDriver GLMax2DDriver() 'SetGraphicsDriver BufferedD3D7Max2DDriver() Graphics 1024,768,32 While Not KeyHit(KEY_ESCAPE) DrawLine MouseX()-5,MouseY()-5,MouseX()+5,MouseY()+5 DrawLine MouseX()+5,MouseY()-5,MouseX()-5,MouseY()+5 'Flip 0 ' no lag Flip 1 ' mouse lags 'Flip -1 ' mouse lags Cls Wend Same problem here in windowed or fullscreen mode. The mouse lags when waiting for the vertical blank. No difference between the max2d graphics drivers here. |
| ||
Hi stuart, mine lags on all combinations. It might help to point out at this stage, that I am using a Radeon 9800 PRO, latest drivers. I don't get this problem in other DX games btw, just in Blitz3D and Blitzmax. |
| ||
It might help to point out at this stage, that I am using a Radeon 9800 PRO, latest drivers. Seems to be a graphics card issue then, I also have a Radeon 9800 Pro, custom drivers and it lags. Doesnt lag at all (on any combination) on my other computer (Radeon X600 Pro) |
| ||
The latest driver might be a problem ... had some serious issues with the 5.11 generation (not running DX7 and 8 games, blue screen of death with WinXP Pro?!) and reversed to a 5.09 Omega because of that. |
| ||
Tried older driver with the same story. |
| ||
It lags for me with flip 1 or -1. |
| ||
Try this then:'SetGraphicsDriver D3D7Max2DDriver() 'SetGraphicsDriver GLMax2DDriver() SetGraphicsDriver BufferedD3D7Max2DDriver() Graphics 1024,768,0 While Not KeyHit(KEY_ESCAPE) SetColor 255,255,255 DrawLine MouseX()-5,MouseY()-5,MouseX()+5,MouseY()+5 DrawLine MouseX()+5,MouseY()-5,MouseX()-5,MouseY()+5 While PollEvent() If CurrentEvent.id = EVENT_MOUSEMOVE x = CurrentEvent.x y = CurrentEvent.y EndIf Wend SetColor 255,0,0 DrawLine x-5,y-5,x+5,y+5 DrawLine x+5,y-5,x-5,y+5 'Flip 0 ' no lag Flip 1 ' mouse lags 'Flip -1 ' mouse lags Cls WendIs there any (significant) difference in the position of the red and the white cross? It might vary a few pixels once in a while, but that is to be expected. |
| ||
Is there any (significant) difference in the position of the red and the white cross? No difference in the position of the two crosses here. |
| ||
I get mouse lag with all drivers regardless of Flip value. Specs.. AMD64 3000+ Gigabyte Radeon X800 XT PE 1GB o' RAM Onboard RealTek audio Can't think of anything else that would have a noticeable effect on it at the moment. |
| ||
No difference between the crosses for me either, and no lag between the mouse cursor and the cross. There is lag between the cursor and the cross in fullscreen mode |
| ||
I get significant lag with all 3 flips on both DX drivers, but -no- lag on the opengl driver. |
| ||
Noel, Stuart, the cross is lagging for you on fredborg's example? |
| ||
Yes. That's what I said. |
| ||
Just making sure. This really needs to be fixed! |
| ||
Noel, Stuart, the cross is lagging for you on fredborg's example? Yes, both crosses are lagging. |
| ||
Both crosses are lagging!? You mean they're at the same place, but lagging the windows mouse pointer? That's what I get. But the demo is meant to show difference between 2 different methods of polling mouse position. |
| ||
You mean they're at the same place, but lagging the windows mouse pointer? Yes |
| ||
Interesting. If it's noticeable it's probably not a rendering delay. |
| ||
It's definately not a rendering delay... it is proper lag. I can tell how it should be when using ogl (or any commercial mouse driven game) |
| ||
I too have seen this. And I can confirm it happened in Blitz3D too (and still does). |
| ||
I think it would be a good idea to look out how the Popcap Framework does their input. |
| ||
i get this in AAA games too. GTA, KING KONG, and most games with a 2d-in-3D UI get it. I fix it by (nvidia here) turning the "Max frames to render ahead" down to 0. |
| ||
I do not get this with commercial games that you mention. It's worth pointing out that the option to render ahead is only available on nvidia cards... and I have an ati card. |
| ||
All look spot on to me. It's looking like an ATI DX thing... |
| ||
i had this same problem in DemonStar and windows version of raptor . when i used the dinput func GetDeviceData and was fixed by using GetDeviceState instead to read mouse. Also now that im thinking about this the problem may have something ( or just made it worse ) by not giving enuf time back to system for the directx background processes. |
| ||
All look spot on to me. It's looking like an ATI DX thing... I have two ATI cards and it lags on one and not the other. I think they both have the exact same drivers too. |
| ||
Happens here in DX fullscreen only. Still using 1.10 |
| ||
I did some "google"ing and it appears that DirectX mouse lag is a know problem and has been around since DirectX6 !!!! |
| ||
I've noticed that if you disable Triple Buffering it significantly reduces the amount of mouse lag. |
| ||
Not here it doesn't. Mind you, I have a whole game, not just fredborg's example... |
| ||
I did some "google"ing and it appears that DirectX mouse lag is a know problem and has been around since DirectX6 !!!! Remember how we used to have these discussion about which was best, OpenGL or DirectX?OpenGL won. |
| ||
It sure does, if you want your game running in software. |
| ||
It sure does, if you want your game running in software. How else would you run it? |
| ||
And those two replies are prime examples of how to troll and bring the tone of a forum down, thank you mikkel. |
| ||
You're welcome Mr. Kettle. |
| ||
Just got this back from QA: 1) cursor sensitivity is very sluggish. The cursor lags behind user input and behaves as though an anchor is attached to it. This is occuring on several machines in the office, mostly laptops with Radeon Mobility 7500's. |