I'm using vb.net with SlimDX, and have a problem. When creating the device, it gives me this error:
SlimDX.Direct3D9.Direct3D9Exception: D3DERR_INVALIDCALL: Invalid call (-2005530516)
at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
at SlimDX.Direct3D9.Device..ctor(Direct3D direct3D, Int32 adapter, DeviceType deviceType, IntPtr controlHandle, CreateFlags createFlags, PresentParameters[] presentParameters)
at SmallGame.Form1.initializeGraphics() in C:\Users\Rene\Documents\Visual Studio 2010\Projects\SmallGame\SmallGame\Form1.vb:line 24
at SmallGame.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\Rene\Documents\Visual Studio 2010\Projects\SmallGame\SmallGame\Form1.vb:line 38
This is my code:
Public Sub initializeGraphics() DEVICE_PARAMETERS = New PresentParameters DEVICE_PARAMETERS.BackBufferCount = 1 DEVICE_PARAMETERS.BackBufferFormat = SlimDX.Direct3D9.Format.X8B8G8R8 DEVICE_PARAMETERS.BackBufferHeight = Screen.PrimaryScreen.Bounds.Height DEVICE_PARAMETERS.BackBufferWidth = Screen.PrimaryScreen.Bounds.Width DEVICE_PARAMETERS.Windowed = True DEVICE_PARAMETERS.SwapEffect = SwapEffect.Copy ENGINE = New Direct3D DEVICE = New Device(ENGINE, 0, DeviceType.Hardware, Me.Handle, CreateFlags.HardwareVertexProcessing, DEVICE_PARAMETERS) End Sub
I've searched, and found some other topics with the same problem. This one. seems to have the same problem. Thier sulution was to call "ZeroMemory" on the DEVICE_PAMAMETERS, after doing "= New PresentParameters", but I don't know how to get the handle of an variable in vb.net.
Please help me,
-René