• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS24 Rendering GDI+ WASM gauge as a transparent screen overlay

Messages
1,040
Country
ca-ontario
I need to have a WASM gauge rendered as a screen overlay, while keeping transparency, (much like HUD), but without mapping it to a 3D surface in my model - basically, I’d like to use is_hud and render_on_screen together. (Parameters in panel.cfg)

I am using GDI+ gauge (as opposed to NanoVG). I tried render_on_screen with transparency, (without is_hud), where I clear the background with color(0,0,0) and it does work, but there is no clearing of the previous screen… so things that change get drawn without older things being cleared. When rendered, it turns into a mess. Without transparency, it works well, but it has to have a solid color background.

All I need is an overlay that shows some dynamic data displayed. Is that possible? I can work with HUD setup as well, but I want to avoid rendering into a 3D part with Texture parameter. I am wondering if NanoVG would have more flexibility in the way the background is cleared?
 
Are you sure that you haven't bounced off the half-assed and incomplete Asobo implementation of GDI+? Also, does it absolutely have to be WASM? Would a 'legacy' C++ gauge work?

I noted a while ago that NanoVG has not been actively developed/supported for some years (just checked; last pull request was August 2023) so if it works with NanoVG you can't rely on Asobo not killing it off with the next MSFS release. Mind you, having said that I can't rely on them not killing off the C++ legacy stuff either.
 
Are you sure that you haven't bounced off the half-assed and incomplete Asobo implementation of GDI+? Also, does it absolutely have to be WASM? Would a 'legacy' C++ gauge work?

I noted a while ago that NanoVG has not been actively developed/supported for some years (just checked; last pull request was August 2023) so if it works with NanoVG you can't rely on Asobo not killing it off with the next MSFS release. Mind you, having said that I can't rely on them not killing off the C++ legacy stuff either.
Legacy gauge? How? a DLL? .gau? That kills it for commercial side, bcz MS won't accept it for Marketplace. And I have zero patience working with that abomination called RPN 😂

How would they pull NanoVG, when GDI+ is a LAYER on top of NanoVG? That means they would leave XML/JS/RPN as the only way of implementing gauges - and leave 80% of serious devs high and dry.
 
Wait a minute... you've just said something that doesn't make sense. To the best of my knowledge (and Wikipedia's 'coz I've just checked in case my memory is faulty) GDI+ was introduced with WindowsXP and NanoVG is a layer on top of OpenGL. Have Asobo pulled a fast one with GDI+ or did I miss something (entirely possible)?

Mmm. Interesting. OpenGL has been superceded by Vulkan which includes ray tracing. I wonder if that's why NanoVG development has been stopped.

Yeah - I'd forgotten that Microsoft will allow you to create C++ gauges but won't allow you to distribute the end product.
 
Wait a minute... you've just said something that doesn't make sense. To the best of my knowledge (and Wikipedia's 'coz I've just checked in case my memory is faulty) GDI+ was introduced with WindowsXP and NanoVG is a layer on top of OpenGL. Have Asobo pulled a fast one with GDI+ or did I miss something (entirely possible)?

Mmm. Interesting. OpenGL has been superceded by Vulkan which includes ray tracing. I wonder if that's why NanoVG development has been stopped.

Yeah - I'd forgotten that Microsoft will allow you to create C++ gauges but won't allow you to distribute the end product.
Straight from the horse's mouth:

GDI+​

This library provides the implementation of the WIN32 GDI+ API, as a Wrapper of the Low Level API via NanoVG.


Microsoft will allow you to sell EXE/DLL/gau instruments on PC, but not on XBox, because XBox doesn't have the same security measures as a PC. Which to me makes perfect sense, all the while being a debilitating but unavoidable fact.
 
Got it. It's not GDI+ then, but something that takes a subset of GDI+ calls and turns them into NanoVG calls ('as a wrapper of'). As the developer has ceased updating NanoVG, we can be pretty sure that all of those 'not yet supported' calls are never going to be supported.

I think I've been round this loop before with someone but I can't find the original topic. My apologies for diverting you away from your question. I've only ever created one NanoVG gauge and that was running on a solid black background.
 
GDI+ - Windows XP - 2001
NanoVG - 2D vector library for OpenGL - 2013.

Their NanoVG support is an API overlay of GDI+ and it's woefully incomplete, to say the least.
 
GDI+ - Windows XP - 2001
NanoVG - 2D vector library for OpenGL - 2013.

Their NanoVG support is an API overlay of GDI+ and it's woefully incomplete, to say the least.
No - it is not. It doesn't matter what year came what. It is literally the other way round, exactly like the documentation says.

Here - an example. A GDI+ call to draw arc, which calls NanoVG functions:

C++:
    GpStatus WINGDIPAPI
        GdipDrawArc(GpGraphics* graphics, GpPen* pen, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
    {
#ifdef GDIFLAT_SAFE
        if (!graphics || !graphics->ctx)
            return GpStatus::InvalidParameter;
#endif
        convertPen(graphics, pen);
        nvgBeginPath(graphics->ctx);
        nvgEllipticalArc(graphics->ctx, x + width * 0.5f, y + height * 0.5f, width * 0.5f, height * 0.5f, nvgDegToRad(startAngle), nvgDegToRad(startAngle + sweepAngle), (sweepAngle < 0 ? NVG_CCW : NVG_CW));
        nvgStroke(graphics->ctx);
        return GpStatus::Ok;
    }

Incomplete, yes, but it let's you "roll your own". I needed a dashed line style (which is not supported, and it is crucial for instrumentation development) so I wrote my own GDI+ dashed line style function that uses NanoVG functions. I created the whole PFD/ND display (including mouse support) using their GDI+, and save the dashed line, it did everything as advertised. The only other thing that didn't work (that I needed) was a clip region constructed of polylines, but that can be overcome by constructing graphics paths.

MS/Asobo did the right thing. They didn't give us a new API (NanoVG) and just said "Here you go, a new API, oh, you have 30 gauges written in GDI+? Tough cookies, deal with it, convert them". Instead, they provided a bridge. It worked in my case, all my gauges are supported with minimal changes.
 
Last edited:
None of my gauges can be made to work on an X-Box. Impossible. I see your point regarding NanoVG.. but, it's total crap that's no longer supported by the creator, bad position.
 
None of my gauges can be made to work on an X-Box. Impossible. I see your point regarding NanoVG.. but, it's total crap that's no longer supported by the creator, bad position.

Ok. Microsoft/Asobo bad 😄. How about my original question - did you ever get HUD to work as a screen overlay, as opposed to mapped to a model material?
 
I've done overlays.. they destroy framerates based on the render size.. so I rarely touch them. I've done nothing for this X-Box stuff, so can't honestly say if what I've done would work.
 
I've done overlays.. they destroy framerates based on the render size.. so I rarely touch them. I've done nothing for this X-Box stuff, so can't honestly say if what I've done would work.
Ok, thanks for the input, I appreciate it!
 
Back
Top