I'm trying to work out a way to mix OpenGL rendering and GDI in Windows. Previously I've been rendering my OpenGL contents into a framebuffer object, extracting it and then blitting it into the windows GDI graphics context and then drawing my GDI stuff over the top. This is really crippling the framerate.
I'd like to do the opposite to what I am doing now, so my OpenGL rendering is done directly to the window and then I render GDI stuff to a bitmap which is uploaded to a texture and then overlayed using a quad. The GDI stuff doesn't change all that much so I don't need to redraw it every frame, I can just cache the texture.
I can almost get it working, the problem is that I can't seem to get the correct alpha values from the GDI bitmap so text and lines get horrible jaggies.
Does anyone have any useful resources for how to do this? Is it even possible to get GDI or GDI+ to write to the alpha channel in the way I need?