Sign in to follow this  
  • entries
    72
  • comments
    104
  • views
    45408

Citizen: Graphics API isolation.

Sign in to follow this  

196 views

Citizen: Graphics API isolation.

Since last time I posted I've worked on the graphics system, trying to isolate as much API-specific code as possible. Before I began my GraphicsDevice class which is the graphics system motor was littered with DirectX9-specific code, and some of it even leaked out into the calling application. I'd like to keep my options open for multiple API support later on, like DX10 and/or OpenGL, so this really had to go.

My solution to this was to make GraphicsDevice into an interface (IGraphicsDevice) that exposes common graphics operations to the application. The interface is then implemented by D3D9Device which encapsulates all DX9-specific calls. This restructure wasn't entirely painless. I had to write some helper classes to port things like coordinates from DX9 to non-DX9, and I'm still in a process of adjusting which methods should be known by IGraphicsDevice and which should be internal to D3D9Device.

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

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