Original Post
Bah, MS [disturbed] Can anyone make sense of this?
Quote:vs
DirectX Documentation: ID3DXEffect::GetParameterByName Method -------------------------------------------------------------------------------- Gets the handle of a top-level parameter or a structure member parameter by looking up its name. Syntax D3DXHANDLE GetParameterByName( D3DXHANDLE hParameter, LPCSTR pName ); hParameter [in] Handle of the parameter, or NULL for top-level parameters. See Handles. pName [in] String containing the parameter name.
Quote:I don't understand what's going on. D3DXHANDLE is defined as "const char*". How could GetParameterByName( hParameter,"g_mWorldViewProjection"); be filling hParameter with a handle? The parameter is even accepted as [in]. Also, what is up with "g_pEffect->SetMatrix(hParameter);". How exactly is that setting a matrix in the shader? There isn't even a matrix being passed? I've tried using the return value, but it turns out null. There are no error codes to speak of. Anyone know how to do this? [smile]
DirectX Documentation: When setting uniform shader constants, it is more efficient to cache a handle to the parameter by calling ID3DXEffect::GetParameterByName. This avoids the string lookup that is necessary when calling effect methods like ID3DXEffect::SetMatrix. // Instead of setting a uniform constant like this in the render loop g_pEffect->SetMatrix( "g_mWorldViewProjection", &mWorldViewProjection ); // Get a handle to a uniform constant outside of the render loop D3DXHANDLE hParameter; GetParameterByName( hParameter,"g_mWorldViewProjection"); ... // Use the handle to set the uniform constant in the render loop g_pEffect->SetMatrix(hParameter);