从Int32转换为'Microsoft.DirectX.Direct3D.VertexShader'

时间:2010-03-04 13:01:09

标签: vb.net

如何解决错误 无法将类型为“System.Int32”的对象强制转换为“Microsoft.DirectX.Direct3D.VertexShader”

我们希望将''System.Int32'值转换为'Microsoft.DirectX.Direct3D.VertexShader' 我试过CType但没有工作。 也试过了 mD3DDevice.VertexShader = CObj(D3DFVF_CUSTOMVERTEX_BOX)  但没有运气  你能帮忙吗

1 个答案:

答案 0 :(得分:0)

Microsoft.DirectX.Direct3D.VertexShader是一个类,一个引用类型,而不是一个值类型。您无法直接将System.Int32转换为VertexShader,因为VertexShader不是基于System.Int32,并且没有预定义的转化。 如果您能想出将System.Int32转换为VertexShader的合法方式,则可以自行实施转化。

否则,您似乎应该:

  1. 咨询VertexShader documentation,具体而言 其constructors文档。
  2. 使用特定设备     Device.GetVertexShaderInt32Constant     和     Device.SetVertexShaderConstantInt32     方法。