Sign in to follow this  

Vector global variables in HLSL not working

This topic is 4308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites

This topic is 4308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this