DX9, DX10, GL2.1 and GL3 wrapper (w.r.t. shaders)

Based on the interface of DX10 (and I guess and hope the upcoming GL3 API will be very similar) it would be easy to write a thin wrapper for DX9, DX10, GL2.1 and GL3 backends on a rendering device level.

The heardest problem will be to overcome the differences in the shading languages. How do you deal with this problem? Using CG? Using another intermediate language? Writing shaders twice.

Yep, or writing your own “shading language” is a possibility, then translate it to any flavor you like. Of course then you’ve inherited the hassle of having to maintain it. Leveraging or preferring one language in particular and translating it to another is a way to go (there are some tools for this already).

It’s a problem but there are lots and lots of possibilities. I personally have a very high level script of sorts I convert to a shader on the fly; falls somewhere short of a complete language though…