开发者

App using 3D & 3rd-party plugins - forward compatible OpenGL or Direct3D?

开发者 https://www.devze.com 2023-02-03 12:19 出处:网络
I\'m writing an app that\'s going to use 3rd-party created plugins to render all kinds of 3D trickery.

I'm writing an app that's going to use 3rd-party created plugins to render all kinds of 3D trickery.

My main application is to create the context / render-object and a rendertarget/framebufferobject. The 3rd-party plugins are going to be rendering their fancy stuff to that, so they need access to that context / renderobject to perform their 3d-render-related calls.

I can choose to implement this using either OpenGL or Direct3D. My decision will most probably be based on my understanding of the next problem :

开发者_如何学C

Obviously, new versions of OpenGL / Direct3D will be coming out, and it would be nice if newly created plugins could benefit from newer versions of DX/OGL than the main program was compiled with. (if the computer running the application supports that newer version)

Using OpenGL (using OpenTK) I understood it's possible to create a forward-compatible context, as in "Give me the most up-to-date-version that is backward compatible with version X". So when asked for a 3.2 context, if 4.0 is available it would return a 4.0 context.

For DirectX, I don't see anything like that, which would mean that if I create my main program with DirectX 11 for example, 3rd-party plugins would never be able to use newer versions when available ?

Am I getting this correct ?

Will OpenGL enable 3rd-party plugin writers to create plugins for newer versions of OpenGL, while DirectX will not allow me to do something like that ?


I'd be amazed if DirectX ever supported the sort of compatibility you're talking about within an application. Each version of the Direct3D APIs has basically been an independent (COM) object hierarchy with absolutely no acknowledgment that other generations of the system might exist, past or future. (Backwards compatibility at the platform level has generally been superb, of course, but you're after something quite different).

So either go with OpenGL (the support you mention at least sounds like it offers some hope), or maybe even consider a higher level API for plugins which somehow "compiles"/"adapts" to the actual target platform at runtime. That'd let you support OpenGL and Direct3D (although obviously shaders in particular would present severe difficulties; hence projects like AnySL).

0

精彩评论

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

关注公众号