   How to do multiple renderers?
  Hello!I was thinking about how it is possible that some Engines can have support for OpenGL, various version of DirectX? Writing a MeshLoader for all of them is not *such* a big problem, since it's done when it's done. But what if I want to target, lets say: OpenGL,DirectX9 and DirectX11. When I want to write a shader, do I have to modify it to fit into all of my graphic APIs? Wouldn't it be full of makros and such stuff? Or maybe I would have to write it again, don't I? Or maybe there is a nice trick, that I don't know! =)   
  Ideally there should be very little API related stuff in your engine. You don't really need to write a whole new meshloader for OpenGL and DX, they pretty much use the same things: arrays of vertices, arrays of texture coordinates, etc.That stuff is all standard and then you can IFDEF the API calls through an abstraction layer.Using shaders would require a bit more work, but I think all you would really need is to tweak the syntax a little bit, the algorithms should still be mostly the same. You could probably write a little script to convert from GLSL<->HLSL without too much trouble, I imagine it is mostly just changing the headers and maybe some keywords.   ;  You could write all shaders in Nvidia's Cg shader language.It's cross API and cross platform. ATI Supports it last I checked, I don't know how well supported it is from other card manufacturers though.   ;  Cg is for every API? Wow, did not know this. :) Anyways, I like to stay on windows and I was only wondering how they all did that. Another question:Will a precompiled shader from DirectX10 be usable in DirectX11 or 9?Do I have to compile 3 different shaders then? (Or two, because I can let DX10 out since DX11 is mostily the same =) )   