Wgl / SimpleOpenGlControl : 8-bit paletted display mode support.
Hi all,
I need my windows app to work decently over a low-bandwidth remote desktop connection, so that means working w/ an 8-bit palette display... I made a few modifications that do the trick to SimpleOpenGlControl; here they are. (There are some duplicate members that could be had from the base SimpleOpenGlControl except they were private rather than protected.)
The code isn't finished exactly. I suspect it would be better for it to be made part of the core SimpleOpenGlControl, or at least for SimpleOpenGlControl to allow subclasses to override things like InitializeContexts and MakeCurrent. Also, I haven't done any testing whatsoever except to verify that it seemd to work over 8-bit remote desktop. No idea what will happen on a physical 8-bit display!
The code is here: http://monoport.com/16839. I tried putting it inline but your forum doesn't format it very well. 
First, we need some P/Invoke calls that are not in Wgl or Gdi. I don't P/Invoke too often so I may have done something wrong w/ the marshalling... but no segfaults so far!
Then, some extra context initialization; this is a separate method but needn't be if InitializeContexts() was virtual.
Last, we need a different version of MakeCurrent that will select the palette if it exists and change OnPaint to use that ExtraMakeCurrent() instead.
---
Side topic: Does anyone know which of disabling double-buffering, liberal use of glScissor, and assoc. tricks would be best to reduce round trips & data size in a remote desktop setting? An atypical situation, I know.
(If the whole buffer gets sent regardless of glScissor, I suppose I could fallback to never swapping, reading the pixels from the back buffer, and drawing just the changed area with GDI+... lots of hackery for an edge case, so I suspect this is just idle musing.)
