Radfordhound / HedgeLib

A C++ library and collection of tools that aims to make modding games in the Sonic the Hedgehog franchise easier.
MIT License
90 stars 29 forks source link

HedgeEdit - Low Refresh Rate #17

Closed Radfordhound closed 5 years ago

Radfordhound commented 6 years ago

The viewport is currently rendered in the Application_Idle event, which occurs whenever the program is about to go into an idle state.

This produces a weird "laggy" feeling due to how inconsistent the rate at which this event is called is. Even weirder, if you move the mouse cursor around it seems to trigger the event quicker; meaning that moving your mouse around while moving the camera literally makes the frame-rate much smoother??

Ideally we need some method of just updating 60+ times per second. That doesn't necessarily mean rendering each time; only when things have changed. But we do need to check for camera movement and such each frame at a consistent interval.

Radfordhound commented 6 years ago

Using RenderLoop.Run now from SharpDX.Windows 6ddb47ef9111b38302b53a6abe5da7e399b18f6c It's much better than what I was doing before but the refresh rate is still a little weird, and overall performance could be much better; the GL version could render the whole stage at once at 60 FPS with no problem what-so-ever.

Not sure what I'm doing that's inefficient in the Direct3D version? Again the GL version had no troubles even when I was binding mesh data once per instance and all lol so I really don't get this... it should be way faster now yet it's way slower?

There's got to be something I'm calling that's really slow and I just don't realize it lol. I'm trying to narrow it down.

Radfordhound commented 6 years ago

Well this helped a ton lol, seems setting textures is a bit slow in D3D. 511693213aaa2f9452c93a8d4db461890debcd17

Mouse movement still seems a little "laggy", but the framerate itself is pretty decent now (for me at least). I'll keep this issue open until I make mouse movement more smooth, then I'll close it.