开发者

Sharing a texture between direct3d and opengl?

开发者 https://www.devze.com 2022-12-08 21:47 出处:网络
I know mixing OpenGL and DirectX is not recommended but I\'m trying to build a bridge between two different applications that use separate graphics API:s and I\'m hoping there is a technique for shari

I know mixing OpenGL and DirectX is not recommended but I'm trying to build a bridge between two different applications that use separate graphics API:s and I'm hoping there is a technique for sharing data, specifically textures.

I have a texture that is created i开发者_运维百科n Direct3D like this:

d3_device-> CreateTexture(width, height,
  1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
  &texture, NULL);

Is there any way I can use this texture from OpenGL without taking a roundtrip through system memory?


YES. As previously posted (see below) there should exists at least one solution. I found two possible solutions:

  1. On nvidia cards a new extension was integrated in the 256 dirvers. see http://developer.download.nvidia.com/opengl/specs/WGL_NV_DX_interop.txt

  2. DXGI is the driving force to composite all windows in Vista and Windows 7. see msdn.microsoft.com/en-us/library/ee913554.aspx

I have not yet made experience with either solution, but I hope I will find some time to test one of them. But for me the first one seems to be the easier one.


[I think it should be possible. In recent windows version (Vista and 7) one can see a preview of any window content in the taskbar (whether its GDI, Direct3D, or OpenGL). To my knowledge OpenGL preview was not supported in earlier windows versions. So at least in the newer version there should be a possibility to couple or share render contexts even between different processes... This is also true for other modern platforms which share render contexts system wide to make different rendering effects.]


I think it is not possible. As both have different models of a texture.

You cannot access the texture memory directly without either directX or openGL.

Otherway around: If it is possible, you should be able to retrieve the texture address, its pitch, width and other (hardware dependant) memory layout informations and create a dummytexture in the other system and push the retrieved data into your just created texture object. This is not possible

Obviously, this will not work on any descend hardware, and if so it would not be very portable.


I don't think it's possible without downloading the data into host memory and re-uploading it into device memory.


It's possible now.

Use ANGLE OpenGL API instead native OpenGL.

You can share direct3d texture with EGL_ANGLE_d3d_texture_client_buffere extension. https://github.com/microsoft/angle/wiki/Interop-with-other-DirectX-code#demo


No.

Think of it like sharing an image in photoshop and another image viewer. You would need a memory management library that those two applications shared.

0

精彩评论

暂无评论...
验证码 换一张
取 消