• 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.

MSFS20 GDI+ Setting Polygon as a clipping region does not work.

Messages
75
Country
us-newyork
Hello all,

Continued from my previous post, I cannot seem to set a clip, using a polygon. If I just define and fill a polygon, no problem, comes out just as it is supposed to. But setting this same polygon as a clip region is NOT working.

Here is the code:
C++:
    GraphicsPath VSIClip;
    VSIClip.AddPolygon(p.hFrameShape, p.hFrameShapeCount);
    gfx->SetClip(&VSIClip); // doesnt work

    gfx->FillPolygon(&brushDarkOverlay, p.hFrameShape, p.hFrameShapeCount); // this does work, the polygon is rendered

Anyone have an idea about this one?
 
VSIClip.Reset() before you add the polygon. Also, a clip just restricts where rendering can be done... it doesn't do anything else on it's own.
 
Thanks for your suggestion, unfortunately no luck. This is the VSI area, basically a 10 point polygon, (on the left) and this is what I get when I use the same polygon as a clip mask (on the right):

1764216148766.png
1764216291613.png


No idea what is going on. Since I need to clip only the right portion of the needle, I resorted to adding a clipping rectangle along its right edge, and that works. But a proper way would be to just add the same polygon used for the darkened VSI area.
 
I don't write anything for the new sim as it's not 100% working, and you may have found a new issue. This is not a GDI+ issue as I've used code like this in Prepar3D. MSFS20/24 don't actually use GDI+, it's something else that's got a GDI+ looking front-end.
 
Yep. From the SDK docs:

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

So they have mucked about with the basic GDI+ implementation in an attempt to sandbox it.
 
Might I suggest you create the shape using lines instead of a polygon and see if that works?
 
A whole ten minutes of reading up on NanoVG leads me to think that the following is happening:

- the GDI+ calls are being intercepted by the sim and converted to NanoVG
- NanoVG is then doing the on-screen drawing
- the conversion from GDI+ calls to NanoVG calls is incomplete as WarpD suggests
- all the above is pretty much confirmed by this topic here: NanoVG API

You may be better off converting to direct NanoVG drawing in future.
 
Whoa! I guess I'll have to look into NanoVG to implement things GDI is failing at.

I didnt see anything there about the dashed line not working (as per my other post)...

Thanks for looking into this, guys!!
 
Back
Top