bepu / bepuphysics2

Pure C# 3D real time physics simulation library, now with a higher version number.
Apache License 2.0
2.25k stars 261 forks source link

Debug assert with wrong resolution. #278

Open emelrad12 opened 11 months ago

emelrad12 commented 11 months ago

image

Freshly cloned repo, on 4k display. I am running the demo project. I am using windows 125% scaling, so perhaps something breaks there? This error was not present in previous versions.

Removing the debug asserts, makes it work again, with no noticable issues, like screen clipping, or anything else broken.

RossNordby commented 11 months ago

Presumably there was a reason for that assert at some point, but I no longer know what it was. It does indeed seem to work fine. I've removed the assert in 91f724e058c91e8648982567d7fc631e6f884233.

Thanks for the report!

emelrad12 commented 11 months ago

Okay so after playing around a little bit, your resizing when the dpi changes is broken, as the new window is the wrong size. Afterwards it seems you are covering a bug by doing Resolution = resolution; which overrides the resolution provided by OpenTK, which seems to "fix" the bug, as open tk returns a window that is well n times larger(n being the scaling) that it should be. So if you are setting as right now 75% of screen with, it returns n 75%, n > 1, which might cause n 75% > 1. Which is clearly bug.

No idea how to correctly fix that, just reporting.

damian-666 commented 11 months ago

I had to comment the assert first day i tried this on a MS surface.. wiht 150% scaling and default hires. This i just tried and it might fix the problem.

maybe look at this in the app manifest.. uncomment that. dpi awareness.

first you need to create an app manifest.. i use an external one. I think that will fix your issues. If you are using 150% or its hard to read.

If you use two monitors to debug, which is often needed unless there is a super nice tooling IDE wiht docking setup specific for you app,level editor, you will need dpi awareness you drag a window across the two desktops.

i found the file its gets called. app.Manifest i find it in the demo folder

--> true/pm permonitorv2,permonitor true

I dont know if its compatible with the OpenTK , seems to be.

image

on and aside..

if anyone knows any tooling that does boilerplate or UI stuff , with openTK save current window state, or scripting, or general UI, like buttons and property sheets. if not exiting users of Bepu we should put that somewhere and share the effort. or multiplatform hosting..

Avalonia UI is getting good.

its painful.. and its common use for anyone.

Also there is a thing called Avalonia.Inside that lets you use avalonia UI, scripting, Avalonia Edit, that as a tooling and embed a Monogame window in that.. its not great but gives some real time parameter tooling and scripting ability. via avalonia so you dont have to use two apps, yours and a hard debugger that blocks, just to tune some levels..

It can work with Avalonia and Docking , REact or WPF, either way

ideally a rigging with an editor like stride has and a with a soft debugger like CS-Script has made, that does not block threads but lets you adjust and inspect and not run a big debugger AND an game UI.. , and you make your own rigging IDE..

for debu in avalonia this might be a good rig.. then put your scripts in a dll and build with your game after.. your host in avalonia if tis fast enough an shares a backbuffer, not using a buffer unless you are doing lockless producer / consumer and have one anywasys.

https://wieslawsoltes.github.io/Dock/ https://github.com/SamboyCoding/OpenTKAvalonia

I use 150 scaling resolution and had to debug the assert. The real fix i think it this, i justed tested that it makes a difference in hi rest and 150 scaling, the default.