2010-03-04 60 views
0

如何解決錯誤 無法投類型的對象System.Int32爲鍵入「Microsoft.DirectX.Direct3D.VertexShader」從鑄造的Int32爲「Microsoft.DirectX.Direct3D.VertexShader」

我們要''System.Int32'值到'Microsoft.DirectX.Direct3D.VertexShader' 我嘗試過CType,但沒有工作。 也試過 mD3DDevice.VertexShader = CObj(D3DFVF_CUSTOMVERTEX_BOX) 但沒有運氣 能否請你幫

回答

0

Microsoft.DirectX.Direct3D.VertexShader是一個類,引用類型,不是值類型。您不能直接將System.Int32轉換爲VertexShader,因爲VertexShader不基於System.Int32,並且沒有預定義的轉換。 如果您可以考慮將System.Int32轉換爲VertexShader的合法方式,則可以自行實施轉換。

否則,看來你應該:

  1. 諮詢VertexShader documentation,特別 其constructors文檔。
  2. 使用特定設備的 Device.GetVertexShaderInt32ConstantDevice.SetVertexShaderConstantInt32 方法。
+0

感謝您的回覆。 它的9.15 PM和它的時間離開....將嘗試明天。 謝謝...... !!! – Avinash 2010-03-04 15:44:03