| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 05/09/2006 at 00:30:23
| | I have just started going through the DirectX C# tutorials here, and have had a few slight problems with version differences, but when calling DrawUserPrimitive from this example I get the error "error CS1503: Argument '3': cannot convert from 'Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored[]' to 'Microsoft.DirectX.GraphicsBuffer'"
I have not been able to solve this error, nor have I been able to find any documentation anywhere on Microsoft.DirectX.GraphicsBuffer.
Here is my code. Any help would be greatly appreciated.
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored[] vertices =
new Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored[3];
vertices[0].Position = new Vector4(150f, 100f, 0f, 1f);
vertices[0].Color = Color.Red;
vertices[1].Position = new Vector4(this.Width / 2 + 100f, 100f, 0f, 1f);
vertices[1].Color = Color.Green;
vertices[2].Position = new Vector4(250f, 300f, 0f, 1f);
vertices[2].Color = Color.Peru;
device.Clear(ClearFlags.Target, Color.Blue, 1.0f, 0);
device.BeginScene();
device.VertexFormat = Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored.Format;
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, vertices);
device.EndScene();
device.Present();
}
|
| |
|
|
| |
| |
| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 05/09/2006 at 01:06:00
| | Ok, I have an update to my problem. I deleted my DirectX Reference and rolled back to the 1.0.2902.0 version. This allows the code to compile, however I get a runtime error of "System.BadImageFormatException. This is not a valid Win32 application."
With the 1.0.2902.0 I cleared the file and pasted all of the lesson 2 code in, and was given the same runtime error. I had been able to complete and run Lessons 1 and 2 without any problems with version 2.0.0.0 of DirectX.
Any help is appreciated. Thanks in advance. | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1388 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 05/09/2006 at 02:36:16
| | | MDX 2.0 will never be officially completed, so the reference is there only to confuse people ;) | |
|
|
| |
| |
| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 05/09/2006 at 11:53:19
| | Do you have any idea why I would be getting the runtime errors, when compiling your code on the older version of MDX then?
Thanks,
Cronus | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1388 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 05/09/2006 at 13:41:47
| | Sometimes when going from the April to the June version or so of the SDK, MS decides to change the interface to some methods, to make the whole more coherent. So you shouldn't be surprised to see a few major changes in the new 2.0 version.
It's a new wrapper. It's pretty difficult (or even useless) to change the inner clockwork of a wrapper without changing its interface. | |
|
|
| |
| |
| Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 05/09/2006 at 14:23:52
| | I understand that, but I don't understand how I am supposed to pass in an array of vertices as a System.Object. I have it as an array of CustomVertex.TransformedColored objects as described in your tutorial, but I can't figure out how to turn that data into a System.Object type, as per the new parameters of DrawUserPrimitive(). I don't know if I am missing some simple way to convert, or if it is supposed to be passed similiar to a void pointer? It has me quite confused.
Thanks for the quick response.
-Cronus | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1388 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 05/09/2006 at 15:34:18
| | | Can't help you with that, I have almost no experience with MDX2.0, and I suggest you to revert to MDX1.0, as the 2.0 development has been abandoned. | |
|
|
| |
| |
| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 06/09/2006 at 00:08:49
| | I deleted my DirectX References and rolled back to the 1.0.2902.0 version. This allows the code to compile, however I get a runtime error of "System.BadImageFormatException. This is not a valid Win32 application."
I've tried opening some older DirectX tutorials with references to 1.0.2902.0 and I get the same runtime error. Do you know what I would have to do to get rid of this error?
Any help is appreciated. Thanks in advance. | |
|
|
| |
| |
| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 06/09/2006 at 01:48:28
| | | Ok, I have uninstalled my DirectX SDK and installed the April version, and when trying to compile your tutorial or any DirectX app I get a System.BadImageFormat Exception. Do you have any idea how I can get rid of these? | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1388 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 06/09/2006 at 02:49:26
| | You didn't have to uninstall you SDK ;)
the original MDX1.0 references are still included in the latest SDK release
Regarding your error, I think it's best to uninstall the SDK again and reinstall the newest one .. sorry for confusing you ;)
| |
|
|
| |
| |
| Poster | : Cronus | | Posts | : 6 | | Country | : USA | | City | : Seattle |
| | | | Posted by Cronus on 07/09/2006 at 17:35:56
| | I had tried the older references in the newest SDK, which is what prompted me to try the older SDK's. I did however get the code to compile, by using the older references, but I had to set the project to sepcifically compile to an x86 architecture.
I am still not sure how to get the DrawUserPrimitive error to work with version 2.0 of the SDK, but I will simply continue my use of the older references with the projects set to the x86 architecture for the time being. | |
|
|
| |
| |
| Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 12/01/2009 at 07:24:52
| | | You can fix that by going into your CPU settings on the IDE. For some reason my error went away when I specified the x86 (instead of Any CPU as per the default) | |
|
|