Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managed C++ and Direct3D

Status
Not open for further replies.

Akusei

Programmer
Jul 15, 2003
90
US
I have a code snippet and it will not compile.


PresentParameters *pp = new PresentParameters();
pp->Windowed = true;
pp->SwapEffect = SwapEffect::Discard;

this->m_Device = new Device(0, DeviceType::Hardware, target, CreateFlags::SoftwareVertexProcessing, pp);


"target" is a System::Windows::Forms::Control object. The constructor seems to be ok and all data being passed to it as well. I get this compile-time error:


error C2664: 'Microsoft::DirectX::Direct3D::Device::Device(int,Microsoft::DirectX::Direct3D::DeviceType,System::IntPtr,Microsoft::DirectX::Direct3D::CreateFlags,Microsoft::DirectX::Direct3D::presentParameters __gc * __gc[])' : cannot convert parameter 5 from 'Microsoft::DirectX::Direct3D::presentParameters __gc *' to 'System::IntPtr'


This makes no sense because in this constructor there is no parameter that needs to be an IntPtr... the constructor is this


Device(int, DeviceType, Control __gc *, CreateFlags, PresentParameters __gc * __gc[]);


Does anyone know why this will not compile?
 
Just to clear something up as well. In the Error above it shows the constructor with System::IntPtr as parameter number 3. This is incorrect! the parameter is actually supposed to be "Control __gc *". I have no clue why it shows up in the error this way. Also, if I make the 5th paramter "pp" to NULL it will compile just fine (this will not work at run-time though).
 
How does this make sense!!!

I changed the call to the constructor to this


this->m_Device = new Device(0, DeviceType::Hardware, target, CreateFlags::SoftwareVertexProcessing, (IntPtr)&pp);


I did this to satisfy the compilers complaining about Parameter 5 cannot be cast from <whatever> to System::IntPtr! After I made this change and tried to compile, it spit this back at me!


d:\Lab\MapEditor\D3D.cpp(60): error C2664: 'Microsoft::DirectX::Direct3D::Device::Device(int,Microsoft::DirectX::Direct3D::DeviceType,System::IntPtr,Microsoft::DirectX::Direct3D::CreateFlags,Microsoft::DirectX::Direct3D::presentParameters __gc * __gc[])' : cannot convert parameter 5 from 'System::IntPtr' to 'System::IntPtr'


Now, can someone please tell me how I can't convert a System::IntPte to a System::IntPtr?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top