开发者

Casting from Int32 to 'Microsoft.DirectX.Direct3D.VertexShader'

How to solved error Unable to cast object of type 'System.Int32' to 开发者_C百科type 'Microsoft.DirectX.Direct3D.VertexShader'

We want to case ''System.Int32' value into 'Microsoft.DirectX.Direct3D.VertexShader' I tried with CType but not working. Also tried mD3DDevice.VertexShader = CObj(D3DFVF_CUSTOMVERTEX_BOX) but no luck Can you please help


The Microsoft.DirectX.Direct3D.VertexShader is a class, a reference-type, not a value type. You cannot directly convert a System.Int32 to a VertexShader, as VertexShader isn't based on System.Int32 and there is no predefined conversion. If you can think of a legitimate way to convert a System.Int32 to a VertexShader, you can implement the conversion yourself.

Otherwise, it seems you should either:

  1. Consult the VertexShader documentation, and specifically its constructors documentation.
  2. Use a specific device's Device.GetVertexShaderInt32Constant and Device.SetVertexShaderConstantInt32 methods.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜