This example is only intended to show the simplest way of using the WGL_NV_interop extension.
For those who wonders what’s the point of all that : windows and openGL are not the best friends, which is making certain things involving hardware acceleration a tough thing to do.
This sample code was developed for a bigger purpose: using Windows Media Foundation to read HD and Ultra-HD video in an efficient fashion. I’ll post more on that in the upcoming days
Other usage of this could be : grabbing the texture of any window in windows and display it in oF (sort of the Syphon way I guess), building a hardware accelerated pipeline for CEF, …
I tested it on a couple of NVIDIA cards and it’s advertised to be working on ATI ones as well.
I hope some people will find this useful, and any thought/comment about all this will be greatly appreciated.
It seems that the new rendering method adds a on_accelerated_paint callback that will give you a handle to the shared texture they’ve created. You can look in https://github.com/daktronics/cef-mixer/blob/eb3fe3db7786aa4a37904e4beab4f305ac2df5f3/src/web_layer.cpp how they get a Texture2D object out of that handle (this object is a custom wrapping around the actual D3D texture).
So basically when you have the texture you should follow what the example i’ve posted does (ie… You open the D3D device once, you create a opengl texture; you register the D3D texture (once) and then you do your stuff).
It might be worthwhile creating your own textures (openGL and Direct3D) so you can copy data around without locking things for too long.
Ah and be careful; I’m not sure every time the callback function is called you’ll get the same texture (I wouldn’t be surprised if multiple ones are created for performance reason)
You can get a raw pointer by calling .get() on the shared_ptr object. If that’s not the problem, I’d double check that the device is already created when you call your code, and then, what options were used to create it; maybe some parameter CEF is using are incompatible with the extension.
(And FYI for the pull request, I’m not working with that company anymore, so not really sure if someone is maintaining the repo…)