Problems setting parameters in HLSL effect

Hi

I'm trying to get a basic effect running in my engine, but I am having difficulties getting the parameters from my code into the effect. They seem to be sticking at the initial value.

For instance I have added time to the glow EffectEdit sample and added a sin(time) term to make the glow pulse. It works fine in EffectEdit, but in my engine, the time sticks at the initial value of zero. I have verified this in the debugger, I am setting the correct value (via Effect.SetFloat) every frame, but in the effect file it stays at zero (even though Effect.GetFloat returns the value I just set). I am having similar problems with my transformation matrices.

I'm setting my params outside begin/end render block so it's not the lack of calling CommitChanges (although I have tried that unsuccessfully).

Any ideas Could I have my device set up incorrectly

Are there any good resources/tutorials around for setting up basic effects The MSDN documentation that I have found seems a little sparse...

Thanks



Answer this question

Problems setting parameters in HLSL effect

  • avjrb

    Thanks.

    I have looked at it before. I thought I was doing exactly the same. However a second glance showed that I wasn't calling SetTechnique... I assumed that a sensible default was assumed (since it was managing to render my technique anyway).

    Perhaps it should warn in debug, and/or patch the parameters into the technique that is chosen as default for rendering...

  • Waheed Iqbal

    Hm, I guess you have checked the examples from the DXSDK You find lots of examples there to compare your code to. For instance look at theBasic HLSL Sample.



    Good luck,
    Nico

  • Problems setting parameters in HLSL effect