   Cg problems with DirectX
  Hi, I'm having some problems with Cg (DirectX 9.0c - MSVC++ 7) and was hoping someone here could help me out.I've got an IMaterialNode class and a DXMaterialNode that inherits from it in my engine.  The IMaterialNode takes care of the basic loading of the material files (custom format, basically a wrapper for a vertex shader, pixel shader and a list of parameters, entry point, passes, techniques, etc.) and the DXMaterialNode is responsible for applying all of these things with the Direct3DDevice object to render the geometry.My problem comes with the shader parameters.  I didn't even notice the problem existed until recently, because all my shaders up to this point had only a single parameter.  I was using the cgGetParameterResourceIndex( ) function to retrieve the position to set the data for the shader constants.  The problem is, it always returns zero, and, as I found out tonight, it's setting an error of CG_INVALID_PARAMETER_HANDLE_ERROR.During the loading phase of the material class, my program uses the cgGetNamedParameter( ) function to retrieve the CGparameter handle for each parameter in the shader(s).  For reference, the first one being returned for a given test material I'm working with is 0x000000a4.  No error is generated during this portion of the program. (Tangent: I don't like Cg's error handling methods.  Having to call cgGetError( ) and compare the return value to CG_NO_ERROR is a pain.)Later, during the rendering phase, I use that same handle, which still has the value of 0x000000a4, to attempt to get the constant index to set.  This is where the error, noted above, occurs.  I've looked through all my code and I'm not releasing the program or anything before trying to use it, and the code inside the shaders works fine (as long as there aren't more than one parameter to be set).Any help would be GREATLY appreciated.  I'm pretty much stuck in my material system until I can resolve this.Thanks in advance,Ray   
  Just a word of advice: This is more of a Cg question than a DirectX one, so chances are you're not going to get a straight answer here. I don't know if there are Cg-specific forums or not, but if there are, you'd better give them a try too [smile].   ;  Perhaps you could write your problem in a single line? I have been using Cg under OpenGL and I use Cg on some DirectX projects I work on. But you problem explanation is simple too long.And 0x000000a4 isnt a particular helpfull value, its allmost null so you problem could be cgGetNamedParameter(.., ...); How does it work without cgGetNamedParameter, by simply using cgSetParameter prior to you shader, instead of working with handles?   