HLSL_Cg shaders and OpenGL?

Problems building or running the engine, queries about how to use features etc.
Post Reply
jacosk
Gnoblar
Posts: 18
Joined: Thu May 14, 2015 12:20 pm

HLSL_Cg shaders and OpenGL?

Post by jacosk »

Hi,
I am trying to get this: http://www.ogre3d.org/tikiwiki/tiki-ind ... e=OceanFog
running in OpenGL.
I do not fully understand if the shaders provided are in HLSL or Cg format (as they contain both in their names).
For the Ocean2HLSL_Cg I found the GLSL equivalent provided with OGRE, but for the MyOcean2HLSL_Cg there is no as it was created for the tutorial (I guess?).

My question is if I have to convert the second shader to GLSL and if yes if there is anything or anyone to help me doing so? I tried hlsl2glsl but the tool does not seem to work (at least for this shader) or I am unable to make it work.
Or is it in Cg (as it's also in its name) and it should work just fine in OpenGL? Because it does not for me because no material is applied to the mesh with this error: WARNING: material ReverseSurface has no supportable Techniques and will be blank. Explanation:
Pass 0: Vertex program HLSL/MyOcean2VS cannot be used - not supported.

Kind regards
User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ
x 69

Re: HLSL_Cg shaders and OpenGL?

Post by areay »

Probably best to learn how shader programmes work and then use that knowledge to do that translation yourself. Here's a good guide on shaders in general http://www.ogre3d.org/tikiwiki/tiki-ind ... e=Cookbook and after that GLSL/HLSL/CG are just differences in syntax.

The likely reason that your ocean shader example has hlsl and CG in its name is that those two languages are extremely similar and compilers for each may accept the same source file without modification.
Post Reply