bmx-ng / gfx.mod

bgfx rendering library backend for BlitzMax
1 stars 2 forks source link

Solve Windows renderer issue. #10

Open woollybah opened 5 years ago

woollybah commented 5 years ago

Currently, on my laptop at least, anything other than the direct3d9 renderer fails to correctly establish the context on the given window. It looks like it may be related to hidpi.

The "basic" example, appears to start okay, but moving the window shows that the actual graphics are rendering at a much higher dpi in the top left corner of the screen - moving the window to the top left and the rendered text appears in the window.

Since one render target appears to be working, we can carry on using this until the issue is resolved. A basic Linux OpenGL test worked as expected.

GWRon commented 5 years ago

Do the original bgfx samples work on your laptop? Just to verify that it is something in the wrapping code.

also with "rendered text" you mean the debug-text you can switch on?

GWRon commented 5 years ago

Dunno what to expect but I compiled the latest version with EBGFXRenderType.OPENGL instead of EBGFXRenderType.DIRECT3D9.

It worked the same and I was able to drag the window around without the text getting displaced. When rendering with OpenGL I got an additional hint for "F11" for a screenshot for "RenderDoc".

Interestingly the FPS decreased a lot (waited a bit after toggling debug text to "settle down"): D3D9: 7500fps OpenGL: 2400fps

This doesn't necessarily mean something (maybe with "more to do" the decrease for D3D9 is higher).

Aside of above (and as said already): with OpenGL on a "non-hi-dpi" device there is no flaw so you seem to be right with your assumption about hidpi.

GWRon commented 5 years ago

Did you check what values you pass from "sdl window" to "bgfx context"? I assume SDL is high-dpi (retina etc) aware but maybe you pass the "low dpi" value to bgfx so it creates a wrong dimensioned graphics context?