views:

309

answers:

3

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 in 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?

A: 

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.

Peter Parker
+1  A: 

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.

goger
A: 

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

tibur