Jump to content
Sign in to follow this  
Guest HC001ST - Stick

Best approach for a light (with C gauges)

Recommended Posts

Guest HC001ST - Stick

Just curious what others thoughts are.Say you want to turn on a warning light, or for that matter another light given conditions. What are others doing to simulate radiosity (the effect of the light hitting other stuff).I guess what I'm saying is that just a bitmap doesn't seem to cut it.Stick

Share this post


Link to post
Share on other sites
Guest ziporama

The best I've been able to do, and I'm not sure if you can use this, has been with my atn.gau pushback/util gauge: I use GDI+ to overlay transparent images with the right highlights (that's how the shadow on the knobs are rendered for example). You have to use a format other than BMP for this, or you can just draw on the canvas directly. Neither is a problem with GDI+. However, the one issue you have is how to store the images because the default resource compiler will not let you store images other than BMP (solution, don't tell it it's a bmp :)). So long as FS is fed a 24 bit BMP in the end, all is well.Think of the entire window area as your image, render the image to memory in GDI+ in layers using alpha channel images or vector rendering in the right order and voila. There is some judicious use of the repaint rate you need to handle, because it will kill your FPS if you do such a complex render op for every frame. Cache the rendered image, and only update when you need to. I borrow a technique from Windows itself when it clips windows area and only repaints the dirty area. There are many routines in GDI+ to help with this.If only FSX would give us a DirectX canvas that doesn't interfere with the rendering engine internals (I'm thinking post render here), we'd have it made using light sources and the like. But, this is for another day I suppose.Hope this helps,EM

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Thanks for your thoughts on this. Yes, it pains me to have to program using the FSAPI when I know how to do what I want in DirectX, haha.I have yet to experiment trying to use GDI+ in FS, but I get what you are saying.Ever try doing DirectX in: PANEL_SERVICE_POST_DRAW ?Patrick

Share this post


Link to post
Share on other sites
Guest ziporama

Yes, although the post render event didn't change the behavior compared to say a pre render or just the regular paint. As a matter of fact, the same thing happened when I used a timer, or subclassed the window to trap the actual OS system messages outside the FS framework.What happened in DX is that while I was able to create a DX context through the FS window handle, or even created my own in memory then rendering to a bitmap, which still requires a context, an amazing amount of flickering resulted if rendered to the same window. No issue rendering to a different window, but that doesn't work in full screen mode because DX only has one render window in this case. The other issue was that I couldn't locate a particular area on the screen to render on while in DX mode. The geometry of the windows that FS uses isn't known, neither is the scaling, so where to render wasn't evident.The flickering as far as I can tell is caused by the rendering multiple DX contexts on the same window, which triggers a global render, and FS redraws over your redraw. I was not able to get far enough into this to find another workaround.GDI+ seemed to be the route to go, although it is quite slow, if but powerful, and I still believe that only works by accident because FS allows you to render bitmaps, and GDI basically creates a dynamic bitmap. I'm not convinced this was ever intended to work that way.What I really would like to see in FSX is an improved SDK that provides more hooks inside FS for add-ons, without having to play "find the needle in the haystack". I'm thinking at least a COM object or other standard interface. At least as far as gauges go, it's not nearly as bad as figuring out dynamic scenery or flexing wings. I've always wanted to add a tug to my gauge, but the way this is usually done is using the model itself, and as a gauge dev I really do not have a way to modify the model. This leaves dynamic scenery. Try to control dynamic scenery from within a gauge, or locate the relative position of the front gear (if you have one) in the scenery... :)EM

Share this post


Link to post
Share on other sites

>What I really would like to see in FSX is an improved SDK that>provides more hooks inside FS for add-ons, without having to>play "find the needle in the haystack". I'm thinking at least>a COM object or other standard interface. At least as far as>gauges go, it's not nearly as bad as figuring out dynamic>scenery or flexing wings. Unfortunately, it's an uphill battle convincing the nice folks at ACES to even leave the ability to create .gau files in the sim at all, much less fix the broken stuff, add missing stuff, and improve gauges.h overall. In any case, don't expect much - if any - changes in FSX... :(


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...