plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

Please take a moment to read the platform’s guidelines before you get started!


evanburnsdev avatar image
evanburnsdev asked

Any way to clear the draw buffer with NVG?

I'm working on drawing a wasm gauge on top of a javascript gauge to provide additional symbology to Bing maps. I haven't discovered a way to clear the draw buffer in webassembly with the gauge api when using nanovg. I've tried using the low level api function FSRenderFlush with the context provided by the gauge_callback before calling nvgCreateInternal, but that always ends up crashing the game.

When just displaying a wasm gauge, the solution would be to call nvgFill with a black nvgFillColor on every PRE_DRAW, but that just completely hides the javascript gauge behind it.

I've gone as far as creating a custom WasmInstrument class so I could set the opacity of the wasm gauge to 0.5, which partly works, but when the map becomes cluttered, or when displaying something white, it overpowers the wasm gauge.

I understand my use-case is kind of one-off, but I think having access to clear the draw buffer could have many benefits for people using the gauge api.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

0 Answers


Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.