• Advertisement
Sign in to follow this  

How is a system with render dependent resources structured.

This topic is 1380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, this question is more of a structural and code based.

Lets say you have some sort of engine in lack of a better name, has as a rendersystem.  The Rendersystem could be OpenGL or DX based.

The Engine have knowleage of some of the common render objects, like Shader, ShaderView, meshes and so on. It does not now what a OpenGL and DX Shader is. How does the more professional systems handle this?

 

I can think of two solutions, one is that the rendersystem has a list of all DX Shader and the Shaders in the engine has an ID to that list (alt 1),

Or that OpenGL Shader would be a subclass of the Engine Shader and cast to a OpenGL Shader every time its beeing used in the Render system (alt 2).

 
(alt 1)

void OpenGL::ShaderInput(EngineShader* pShader)

{

OpenGL* pOpenGLShader = GetOpenGLShader(pShader->ID);

}

 

(alt2)

void OpenGL::ShaderInput(EngineShader* pShader)

{

OpenGL* pOpenGLShader = static_cast<OpenGLShader>(pShader);

DoSomething(pOpenGLShader)

}

 

Just think both solutions seems a slow and maybe a bit wasteful. 

any thoughts pls?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement