Vector global variables in HLSL not working
When I assign values to vectors in effect files, those values do not seem to
be loaded when I actually use the effect file in my own code.
Here's an example of what I mean. I have an effect file with simple pixel shader that looks like this:
.
.
.
float4 myColor = ( 0.00, 1.00, 0.00, 1.00 );
float4 ps_main(in float3 Color : TEXCOORD0) : COLOR0
{
return( myColor );
}
.
.
.
My expectation when I load this effect using Effect.FromFile (in an MDX app) and draw a simple model using the effect, is that the model will be drawn in all green. What actually happens is the model is drawn in all white instead.
When I check the value of the myColor parameter immediately after loading the effect like this:
ColorValue test = m_paintEffect.GetValueColor("myColor");
Sure enough, I find that the value is always {1.0,1.0, 1.0,1.0}
This only seems to be the case with vector type global variables. Other variable types seem to have their values set when the effect file is loaded.
What am I doing wrong here?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement