Ok, so I ended up doing this. The following code is run after setup of the GL context in a hidden window:
EGLSurface sfc = eglGetCurrentSurface(EGL_DRAW);
egl::Surface* surface = static_cast<egl::Surface*>(sfc);
rx::SwapChain9* swap_chain9 = dynamic_cast<rx::SwapChain9*>(surface->getSwapChain()); if(!swap_chain9)
return NULL;
IDirect3DSurface9* surf = swap_chain9->getRenderTarget();
return surf;
The returned surface can be used as back buffer in a D3DImage in a WPF application. This renders correctly with no "airspace issues", i.e I can render WPF controls on top of it and it blends correctly.
However, this solution feels a little bit dirty... Aside from the obvious potential for future changes in the internals of the ANGLE classes, can anyone tell me if this solution is sound enough? I.e can the swapbuffer's rendertarget be used in this manner, or is it just random luck that it works? :-)
I would feel a little more "future proof" if I could use a supported extension. I tried using the EGL_ANGLE_surface_d3d_texture_2d_share_handle extension, but I was never able to get a share handle (it was always NULL). How am I supposed to set up the EGL context in order to get this handle?
The best would be an extension get the the render surface directly, but with a little bit more control of the setup and context. What would be the procedure of proposing such an extension? My employer needs this functionality for a project, and we would be able to put some hours and effort into both the specification and implementation of this extension. Or are there compelling reasons that such an extension should not work?
Best regards,
Thomas Sevaldrud