XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Problems accessing structs in HLSL

Last post 05-19-2008 12:50 PM by Shawn Hargreaves. 1 replies.
  • 05-18-2008 8:24 PM

    Problems accessing structs in HLSL

    Is there a certain order structure members must be in HLSL in order to be accessed properly by the XNA framework?
     
    If I have:
     
     
     
    struct Light 
    {
    float4 position;
    float4 color;
    float3 direction;
    float range;
    float falloff;
    };
    Light light;
     
    and then in code I have:
     
    EffectParameter lightParameter = effect.Parameters["light"];
    EffectParameter colorParameter = lightParameter.StructureMembers["color"]
    Setting the value of the colorParameter doesn't properly set the color parameter.  e.g. if I set a cyanish color, I get a reddish color. And I get different results when I move the structure members around.  It's almost like the values I'm setting are bleeding into adjacent parameters or aren't "aligned" properly.
  • 05-19-2008 12:50 PM In reply to

    Re: Problems accessing structs in HLSL

    We'll need to see some more code to diagnose this: ideally a fully copy of your program that someone could run and experiment with, but at the very least all the code you are using to set and also consume this value.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (2 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG