Author Topic: HLSLShader class?  (Read 1249 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
HLSLShader class?
« on: September 17, 2011, 02:56:04 am »
I'm having trouble making that water shader work. But is an HLSLShader class totally out of the question? I've found them MUCH easier to find, even if you don't count NVidia's excelent selection.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: HLSLShader class?
« Reply #1 on: September 17, 2011, 09:09:09 am »
Hlsl is the DirectX variant of glsl. It's not supported by OpenGL and only available on Windows. Apart from that, it's basically the same thing. Porting between the two shoudn't be that hard.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: HLSLShader class?
« Reply #2 on: September 18, 2011, 12:54:59 am »
Hey, the good news is that I found a HLSL-GLSL translator in SourceForge, written by AMD itself, God bless it. The bad news is that I can't seem to identify what to pass it as the shader's main function (a requirement for the translation). Then I sent you an e-mail asking for help. :- )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: HLSLShader class?
« Reply #3 on: September 18, 2011, 11:22:13 am »
I'll try to look at that this evening. However, i strongly suggest to get a grasp on how GLSL shaders are written. Otherwise, you won't succeed using them even when you are just doing a copy-and-paste job from other shaders. That's one of the big drawbacks of the new and shiny shader world: The learning curve is steeper and you suddenly have to deal with a lot stuff that was hidden by APIs before.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: HLSLShader class?
« Reply #4 on: September 18, 2011, 11:34:09 am »
I think water (liquids in general) is pretty much all I'll ever feel like using shaders for. I'm programming for pretty much all the platforms I've ever seen these days, learning too much as it is, I'm not sure it's worth adding shaders to the list in my particular case. I'll appreciate your help.

You know what? I wrote that just before I went to sleep. Now that I've had two minutes to think about it, I think a better, more accurate, answer would be to say that the more I see shaders work for me (I don't mean to say I've not seen them in games), the more curious I will get about them. It follows that the more I will learn of them. But I can't seem to test a ready-made Nvidia ocean shader, which is not terribly motivating.
« Last Edit: September 18, 2011, 10:09:02 pm by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: HLSLShader class?
« Reply #5 on: September 18, 2011, 09:37:17 pm »
I had a look at that stuff...no idea what this converter is useful for, but for sure not for converting this shader. At first, it had three errors...for example, it couldn't handle blah = -0.2; (it failed while parsing the -). I "fixed" these (for example by removing the -), but then it spit out a dozen additional errors about uniforms not being allowed in function calls and whatnot. Given that this converter dates back to 2006, i think that it's just not feasible for current shader code.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: HLSLShader class?
« Reply #6 on: September 18, 2011, 10:07:11 pm »
Actually, I think it started being developed in '06, but this version is of around November 2009.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: HLSLShader class?
« Reply #7 on: September 18, 2011, 10:09:42 pm »
Anyway, thanks for trying.