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

Started by
2 comments, last by akira32 15 years, 9 months ago
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]
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Advertisement
there is a method called SetFloatArray ( http://msdn.microsoft.com/en-us/library/bb205717(VS.85).aspx )
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.
Million-to-one chances occur nine times out of ten!
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?
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32

This topic is closed to new replies.

Advertisement