1
\$\begingroup\$

Is there a tool that can convert a fragment shader from hlsl to glsl or glsl to hlsl? I do not want to use cg since it is not able to work on mobile platforms.

Is there a tool that can make it so I only write a shader once?

Thanks

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

Shiny is a new library that aims to make material management and portable shader writing easy. This is achieved mostly with a preprocessor meta language, that can output any of CG, HLSL or GLSL. It is currently geared towards usage with Ogre graphics engine, but that part is abstracted into a separate component, so it shouldn't be hard to plug in any other engine. The library has been / is being integrated into OpenMV and Stunt Rally (disclaimer: I'm a member of the latter).

There is a lengthy introduction here.

\$\endgroup\$
1
\$\begingroup\$

I can't vouch for either one, but there is a utility available here for going from HLSL to GLSL: https://github.com/aras-p/hlsl2glslfork

and here for going the other direction: http://code.google.com/p/angleproject/

The first one is explained more here: http://aras-p.info/blog/2010/05/21/compiling-hlsl-into-glsl-in-2010/

\$\endgroup\$
0
\$\begingroup\$

There's the tool MojoShader which accomplishes what you want: http://icculus.org/mojoshader/

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .