Jump to content
  • Advertisement
Sign in to follow this  

Vector global variables in HLSL not working

This topic is 4620 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!