P3D v4 2D panel redraw problem


Resource contributor
Firstly - this ONLY happens in P3Dv4. If compiled to 32-bit and launched in FSX, no problems.

I have a gauge that draws the background (MAKE_STATIC) and two MAKE_ICONS that add two bitmaps to represent night lighting when the cockpit lights are turned on. All instruments and swicthes have the required 'night-lit' additional bitmaps that are switched in with the cockpit lights being turned on. All bitmaps involved in the cockpit lighting have the IMAGE_USE_BRIGHT flag applied in the gauge update callback when the cockpit lights are turned on.

Initial summary: the cockpit light are turned on, the 'lit' bitmaps are all switched in and the IMAGE_USE_BRIGHT flag applied. Reverse for cockpit lights off.

What happens: for between 1 and 10 actions on the lights switch, all works perfectly.
Between 8 and 10 clicks, the following always happens when the lights are turned on:

- The background bitmap lights up and overwrites all the other bitmaps i.e. I see the background only
- All gauges that are constantly updated (e.g. airspeed) immediately reappear
- All switches remain invisible until I click on the relevant area and then they reappear (sometimes just one, sometimes more than one. It depends if they are grouped. For example, the overhead panel switches will all reappear if I click one because they are all in the same gauge).
- P3Dv4 fails to draw transparency i.e. I get big black rectangles on screen.

Turn the lights off and everything reappears correctly (lights off etc.).

Four days later... :banghead: It's obviously a redraw problem but introducing SET_OFFSCREEN into the equation to force a redraw does nothing for the problem.



Resource contributor
Confirmed it's a redraw problem; specifically, IMAGE_HIDDEN seems to behave slightly differently in P3Dv4 compared to FSX. Whether that's because the program is now 64-bit and is compiled differently, I have no idea. The solution (many, many hours) later was to shuffle the gauge contents so that the background lighting images were at the top of the macro list and then control them using the IMAGE_HIDDEN_TREE flag. I wrote a shedload of new macro helpers while I was hammering at this problem (similar to HIDE_LISTELEMENT etc.) which will be included in the next issue of sd2gau.

One of my RL customers is Lockheed Orlando. I have a service request from them at the moment. Maybe I should force them to fix this problem in exchange? :stirthepo:rotfl: