Jump to content
  • Advertisement
Sign in to follow this  
akira32

Which function do I use by defining the float2 array in shader code

This topic is 3725 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

Which function do I use by defining the float2 array in shader code? In shader code,I define a array of float2 called SeedPos,as below: float2 SeedPos[10]; But I in the c++, I do not know which function should I use to send data to shader, SetVector or SetArray? SetVector is 4-dimensions SetFloatArray is One-dimension The float2 is 2-dimensions. [Edited by - akira32 on July 11, 2008 8:11:43 AM]

Share this post


Link to post
Share on other sites
Advertisement
there is a method called SetFloatArray ( http://msdn.microsoft.com/en-us/library/bb205717(VS.85).aspx )

Share this post


Link to post
Share on other sites
You can use either. I think that float2 takes up 4 floats of storage anyway, or is at least aligned as such. When using SetVector it'll effectively just use the first two values. SetArray with a length of two works just as well.

Share this post


Link to post
Share on other sites
D3DXVECTOR2 sampleOffsets[MAX_SAMPLES];
g_pEffect->SetValue("g_sampleOffsets", sampleOffsets, sizeof(sampleOffsets));


Could I use the SetValue function to set the 2d-value array to shader?

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!