Hi,
Is there an easy way to do 3d drawing using drect3d8 devices in c# ?
please dont suggest using directx9 unless there is a way to use directx9 on
devices with only direct3d8 support.
the managed directx9 such as XNA does not support devices with direct3d8
only,
the software rasterizer works but is so mind numingly slow.
Im drawing 3d objects such as surfaces with textures,
created at run time for a wire mesh/model editor.
speed isnt essential but a 3 seconds update time makes panning
with a mouse imposible.
Im trying a few samples but im running into problems,
this one was made for directx8 before directx9 was out
but although it sugests it would work on
directx9 the directx8 sdk doesn not seem to have certian directx8 include
files
such as "d3dx8.h" i managed to get hold of a copy of directx8 sdk.
the c# sample uses a c++ library wrapper for directx8
wich is cuasing the problem :-
the c++ library seems destined for vc7,
the c++ it doesnt seem to work properly on vc8 and I only have vc8 or vc6,
the error I get with vc8 is in the section of unmanaged c++ code.
..........
#pragma unmanaged
// Helper function for calling IDirectInput8:: EnumDevicesBySe mantics from
managed code.
extern "C" HRESULT CallEnumDevices BySemantics(IDi rectInput8 *pDI,
LPCTSTR lpsz, DIACTIONFORMAT *pDIAF,
[MarshalAs(Unman agedType::Funct ionPtr)]
Sunlight::Direc tX::Input::Dire ctInput::DIEnum DevicesBySemant icsCallbackDele gate
*pd,
LPVOID pvRef, DWORD dwFlags);
// Helper function for calling IDirectInput8:: ConfigureDevice s from managed
code.
extern "C" HRESULT CallConfigureDe vices(IDirectIn put8 *pDI,
[MarshalAs(Unman agedType::Funct ionPtr)]
Sunlight::Direc tX::Input::Dire ctInput::DIConf igureDevicesCal lbackDelegate
*pCallback,
LPDICONFIGUREDE VICESPARAMS lpdiCDParams, DWORD dwFlags, LPVOID pvRef);
#pragma managed
..............
..\DirectInput. cpp(52) : error C3821: 'FunctionPtr': managed type or function
cannot be used in an unmanaged function
..\DirectInput. cpp(56) : error C3821: 'FunctionPtr': managed type or function
cannot be used in an unmanaged function
if I comment out the pragmas it compiles but then I get link errors
.........
DirectInput.obj : error LNK2031: unable to generate p/invoke for "extern "C"
long __clrcall CallConfigureDe vices(struct IDirectInput8W *,class
Sunlight::Direc tX::Input::Dire ctInput::DIConf igureDevicesCal lbackDelegate
^,struct _DICONFIGUREDEV ICESPARAMSW *,unsigned long,void *)"
(?CallConfigure Devices@@$$J0YM JPAUIDirectInpu t8W@@P$AAVDICon figureDevicesCa llbackDelegate@ DirectInput@Inp ut@DirectX@Sunl ight@@PAU_DICON FIGUREDEVICESPA RAMSW@@KPAX@Z);
calling convention missing in metadata
DirectInput.obj : error LNK2031: unable to generate p/invoke for "extern "C"
long __clrcall CallEnumDevices BySemantics(str uct IDirectInput8W *,wchar_t
const *,struct _DIACTIONFORMAT W *,class
Sunlight::Direc tX::Input::Dire ctInput::DIEnum DevicesBySemant icsCallbackDele gate
^,void *,unsigned long)"
(?CallEnumDevic esBySemantics@@ $$J0YMJPAUIDire ctInput8W@@PB_W PAU_DIACTIONFOR MATW@@P$AAVDIEn umDevicesBySema nticsCallbackDe legate@DirectIn put@Input@Direc tX@Sunlight@@PA XK@Z);
calling convention missing in metadata
...........
unfortunatly although I know c++ and mfc,
I never got into managed c++ before I moved onto c#
ive spent all day getting this far, but think this is a bit over my head
thanks
Colin =^.^=
Is there an easy way to do 3d drawing using drect3d8 devices in c# ?
please dont suggest using directx9 unless there is a way to use directx9 on
devices with only direct3d8 support.
the managed directx9 such as XNA does not support devices with direct3d8
only,
the software rasterizer works but is so mind numingly slow.
Im drawing 3d objects such as surfaces with textures,
created at run time for a wire mesh/model editor.
speed isnt essential but a 3 seconds update time makes panning
with a mouse imposible.
Im trying a few samples but im running into problems,
this one was made for directx8 before directx9 was out
but although it sugests it would work on
directx9 the directx8 sdk doesn not seem to have certian directx8 include
files
such as "d3dx8.h" i managed to get hold of a copy of directx8 sdk.
the c# sample uses a c++ library wrapper for directx8
wich is cuasing the problem :-
the c++ library seems destined for vc7,
the c++ it doesnt seem to work properly on vc8 and I only have vc8 or vc6,
the error I get with vc8 is in the section of unmanaged c++ code.
..........
#pragma unmanaged
// Helper function for calling IDirectInput8:: EnumDevicesBySe mantics from
managed code.
extern "C" HRESULT CallEnumDevices BySemantics(IDi rectInput8 *pDI,
LPCTSTR lpsz, DIACTIONFORMAT *pDIAF,
[MarshalAs(Unman agedType::Funct ionPtr)]
Sunlight::Direc tX::Input::Dire ctInput::DIEnum DevicesBySemant icsCallbackDele gate
*pd,
LPVOID pvRef, DWORD dwFlags);
// Helper function for calling IDirectInput8:: ConfigureDevice s from managed
code.
extern "C" HRESULT CallConfigureDe vices(IDirectIn put8 *pDI,
[MarshalAs(Unman agedType::Funct ionPtr)]
Sunlight::Direc tX::Input::Dire ctInput::DIConf igureDevicesCal lbackDelegate
*pCallback,
LPDICONFIGUREDE VICESPARAMS lpdiCDParams, DWORD dwFlags, LPVOID pvRef);
#pragma managed
..............
..\DirectInput. cpp(52) : error C3821: 'FunctionPtr': managed type or function
cannot be used in an unmanaged function
..\DirectInput. cpp(56) : error C3821: 'FunctionPtr': managed type or function
cannot be used in an unmanaged function
if I comment out the pragmas it compiles but then I get link errors
.........
DirectInput.obj : error LNK2031: unable to generate p/invoke for "extern "C"
long __clrcall CallConfigureDe vices(struct IDirectInput8W *,class
Sunlight::Direc tX::Input::Dire ctInput::DIConf igureDevicesCal lbackDelegate
^,struct _DICONFIGUREDEV ICESPARAMSW *,unsigned long,void *)"
(?CallConfigure Devices@@$$J0YM JPAUIDirectInpu t8W@@P$AAVDICon figureDevicesCa llbackDelegate@ DirectInput@Inp ut@DirectX@Sunl ight@@PAU_DICON FIGUREDEVICESPA RAMSW@@KPAX@Z);
calling convention missing in metadata
DirectInput.obj : error LNK2031: unable to generate p/invoke for "extern "C"
long __clrcall CallEnumDevices BySemantics(str uct IDirectInput8W *,wchar_t
const *,struct _DIACTIONFORMAT W *,class
Sunlight::Direc tX::Input::Dire ctInput::DIEnum DevicesBySemant icsCallbackDele gate
^,void *,unsigned long)"
(?CallEnumDevic esBySemantics@@ $$J0YMJPAUIDire ctInput8W@@PB_W PAU_DIACTIONFOR MATW@@P$AAVDIEn umDevicesBySema nticsCallbackDe legate@DirectIn put@Input@Direc tX@Sunlight@@PA XK@Z);
calling convention missing in metadata
...........
unfortunatly although I know c++ and mfc,
I never got into managed c++ before I moved onto c#
ive spent all day getting this far, but think this is a bit over my head
thanks
Colin =^.^=
Comment