Sign in to follow this  
monamimani

Graphics class hierarchy design

Recommended Posts

monamimani    146

Hi,

 

I am making a renderer and I have set some goals that i want to acheive because i find them ideal to get a clean design. But I have been thinking and trying to make them happen but I can't find a way. So I am turning to you all for some help and ideas.

 

- First I want to separate common, reusable code from platform specific code and I want to make it impossible for other than the responsible project to be able to include platform specific header like, opengl.h, d3d.h, ....

- Second I want to separate the "graphics object" ( like vertex buffer, mesh, device, texture) and the renderer algorithm ( deffered renderer, forward + renderer)

 

So those goal gave me 4 projects. Lets call them DefferedEngine, OglDefferedEngine, Graphics  and OglGrpahics. Those are actually 4 static lib that link in a GraphicsSystem dll. 

 

- Third the platform is known at compile time so I don't want virtual function. ( This is what caused most of my problems)

 

 

I tried the static polymorphism with CRTP but it is a nightmare... Everything that use the type trough the base class need to be templated. Imagine the device class each create function ( create vertex buffer, create index buffer, create texture) are actually templated with different return type.

 

I am pretty sure someone have to have done this before. how did you do it?

 

thanks alot

 

Emmanuel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this