Error when trying to create vertexbuffer in managed directx

Hi there, I'm a novice c++ / .net programmer with some experience in Java programming. After playing a bit around in VC++2005 i decided to have a look at managed DirectX. I found a tutorial that i thought was pretty good at explaining it to a rookie like myself. Everything went fine until i tried to create a vertex buffer

 

I used this line to create it :

VertexBuffer ^buf = gcnew VertexBuffer( CustomVertex::TransformedColored::typeid, verts->Length, device, 0, CustomVertex::TransformedColored::Format, Pool::Default);

When i tried to compile my code the compiler gave me this error :

c:\documents and settings\wims\my documents\visual studio 2005\projects\dx_cpp_test\dx_cpp_test\Form1.h(112) : error C2664: 'Microsoft::DirectX::Direct3D::VertexBuffer::VertexBuffer(Microsoft::DirectX::Direct3D::Device ^,int,Microsoft::DirectX::Direct3D::Usage,Microsoft::DirectX::Direct3D::VertexFormats,Microsoft::DirectX::Direct3D::Pool,System::EventHandler ^)' : cannot convert parameter 1 from 'System::Type ^' to 'Microsoft::DirectX::Direct3D::Device ^'

I found that very strange, because MSDN said there was a constructor that was appropriate for the code i used ( http://msdn.microsoft.com/archive/default.asp url=/archive/en-us/directx9_m_Oct_2004/directx/ref/ns/microsoft.directx.direct3d/c/vertexbuffer/m/ctor.asp )

Now, what is wrong with my code Is the documentation on creating vertex buffers wrong

 

-Wim

 

 

 



Answer this question

Error when trying to create vertexbuffer in managed directx

  • LarsK

    You are sure that you are not using managed DirectX 2.0

  • gotcf.net

    That's a good question, I'm not sure really. Where can i find out about that I downloaded the DirectX SDK from february. Im using these namespace, don't know if they say anything about which version i use :
    Microsoft::DirectX
    Microsoft::DirectX::Direct3D

     

    EDIT: After changing which version of the managed DirectX i'm using (project->references...) from v2 to v1 the code works



  • Error when trying to create vertexbuffer in managed directx