Are there any tools and/or documentation providing a mapping from DirectX to OpenGL? If you had to do a conversion, how would you approach it and what wou开发者_Go百科ld you use?
I know that ATI Technologies provides HLSL2GLSL, but my understanding is that this is just for shader languages and not a full coverage of the APIs.
The concepts are very similar, but the APIs are very different between DirectX and OpenGL. Automatic conversion is not going to be very straightforward...
Personally, if I had a project and was trying to convert from one solution to the other, I would actually try to convert to a rendering library that supports both, such as Ogre, Irrlicht, or a commercial engine. This way, you can support both DX and OpenGL in one code base.
A long time ago there were proprietary OpenGL-to-DirectX wrappers, used in games, which were as simple as single DLL exposing (sub)set of OpenGL commands can be.
On the other hand, faking DirectX (Direct3D) with OpenGL could be much harder, because you have to support the whole COM thing. So I guess you would have to replicate the required interfaces and only then write the actual wrapper.
精彩评论