Hi,
Making a renderer, all can be emulated for both OpenGL and Direct3D11 but Shader is different on D3D11 and OGL.
D3D11 use constant buffer since OpenGL not (maybe UBO, I don't know new spec of OpenGL).
Is it a way to have a class who works for both ?
Thanks
Shader class GL/D3D11
I strongly suggest against so, it would be full of [font=courier new,courier,monospace]if[/font]s
Use a common interface instead.
Modern GL has cbuffers as well as far as I understand but my GL is admittedly rusty.
Shader re-building is a big deal. I cannot say how much effort I've been spending on it. I suggest to take a look at Cg.
Use a common interface instead.
Modern GL has cbuffers as well as far as I understand but my GL is admittedly rusty.
Shader re-building is a big deal. I cannot say how much effort I've been spending on it. I suggest to take a look at Cg.
UBO is core since 3.1, so that would be the easiest choice if you're ok with learning 3.1's API.
D3D11 use constant buffer since OpenGL not (maybe UBO, I don't know new spec of OpenGL).
I've taken the approach of using the "constant buffer" concept in my cross-API shader class.
D3D9 doesn't support "constant buffers" either, so I emulate them for D3D9 (which is actually extremely efficient).
I'm still working on the GL2.1 version (without UBOs), but I'm also emulating "constant buffers" like I did for D3D9 (but this time it's more complicated), so that my shader interface is consistent across all platforms.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement