473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

using directx8 and c#

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,
http://sunlightd.com/Archive/Windows...T/Default.aspx
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::EnumDevicesBySemantics from
managed code.
extern "C" HRESULT CallEnumDevicesBySemantics(IDirectInput8 *pDI,
LPCTSTR lpsz, DIACTIONFORMAT *pDIAF,
[MarshalAs(UnmanagedType::FunctionPtr)]
Sunlight::DirectX::Input::DirectInput::DIEnumDevic esBySemanticsCallbackDelegate
*pd,
LPVOID pvRef, DWORD dwFlags);
// Helper function for calling IDirectInput8::ConfigureDevices from managed
code.
extern "C" HRESULT CallConfigureDevices(IDirectInput8 *pDI,
[MarshalAs(UnmanagedType::FunctionPtr)]
Sunlight::DirectX::Input::DirectInput::DIConfigure DevicesCallbackDelegate
*pCallback,
LPDICONFIGUREDEVICESPARAMS 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 CallConfigureDevices(struct IDirectInput8W *,class
Sunlight::DirectX::Input::DirectInput::DIConfigure DevicesCallbackDelegate
^,struct _DICONFIGUREDEVICESPARAMSW *,unsigned long,void *)"
(?CallConfigureDevices@@$$J0YMJPAUIDirectInput8W@@ P$AAVDIConfigureDevicesCallbackDelegate@DirectInpu t@Input@DirectX@Sunlight@@PAU_DICONFIGUREDEVICESPA RAMSW@@KPAX@Z);
calling convention missing in metadata

DirectInput.obj : error LNK2031: unable to generate p/invoke for "extern "C"
long __clrcall CallEnumDevicesBySemantics(struct IDirectInput8W *,wchar_t
const *,struct _DIACTIONFORMATW *,class
Sunlight::DirectX::Input::DirectInput::DIEnumDevic esBySemanticsCallbackDelegate
^,void *,unsigned long)"
(?CallEnumDevicesBySemantics@@$$J0YMJPAUIDirectInp ut8W@@PB_WPAU_DIACTIONFORMATW@@P$AAVDIEnumDevicesB ySemanticsCallbackDelegate@DirectInput@Input@Direc tX@Sunlight@@PAXK@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 =^.^=
Dec 10 '07 #1
4 2393
As I understand it, DirectX 8 vs DirectX 9 support is based upon the
driver. It is your driver's responsibility to take advantage of as
much hardware support as possible. If you're only using features that
were available in DirectX8 with your DirectX9 code you should get
reasonable performance. When a video card claims DirectX 8 support, it
means that they had hardware acceleration for everything that was part
of the DirectX8 standard. Most of that standard is still used in
DirectX9. What GPU are you using? What operating system?

As far as your code above, there are attributes to declare the call
type, though I don't know what they are off the top of my head.
Dec 10 '07 #2
"not_a_commie" <no********@gmail.comwrote in message
news:8d**********************************@e25g2000 prg.googlegroups.com...
As I understand it, DirectX 8 vs DirectX 9 support is based upon the
driver. It is your driver's responsibility to take advantage of as
much hardware support as possible. If you're only using features that
were available in DirectX8 with your DirectX9 code you should get
reasonable performance. When a video card claims DirectX 8 support, it
means that they had hardware acceleration for everything that was part
of the DirectX8 standard. Most of that standard is still used in
DirectX9. What GPU are you using? What operating system?

As far as your code above, there are attributes to declare the call
type, though I don't know what they are off the top of my head.
Hi
thanks,
yes I agree its the driver that doesnt support directx9.
the card in question is GeForce4 Ti 4200,
this belongs to someone I am hoping will do some pre alpha testing,
the drivers support directx8 but not dx9,
although dx9.c is installed on that machine ok.

XNA gives up saying its no direct3d9 device found

it doesnt need stunningly fast graphics so
I dont want to restrict it to fairly new graphics cards.

im using winxp sp2 with a ati9800 with no problems,
but im not sure what OS or machine the other card is used on
and I dont want to place hardware/OS restrictions more than a bare minimum.

XNA was a cool environment to get started in,
but with the problems using it in a Forms control panel
its not so atractive.

Ive recently found an excelent c# directx9 sample
http://www.riemers.net/eng/Tutorials...ies1/tut13.php
wich works fine but I cant seem to find out what the requirments
wil be whether this will still require a direct3d9 device
or will allow me to use whatever features are available in
directx8.

I know directx9 is supposed to include all of directx8 but
I realy dont know if using the Microsoft.Directx .net lib
from c# wich is only available in dx9 allows use of directx8 only cards.

as im not sure if its just xna that requires a direct3d9 device or
the managed access to directx9 wich xna uses and wich is what alows acces
from c#.

ofc If i had easy access to a machine with a direct8 only card i could suck
it and see,
but I wont for a few days.

Colin =^.^=
Dec 10 '07 #3
nVidia's drivers definitely support a DirectX9 interface to a TI 4200.
The target machine just needs to have the DirectX9 runtime installed
along with the current GeForce driver from nVidia.com.
Dec 10 '07 #4
"not_a_commie" <no********@gmail.comwrote in message
news:dd**********************************@e6g2000p rf.googlegroups.com...
nVidia's drivers definitely support a DirectX9 interface to a TI 4200.
The target machine just needs to have the DirectX9 runtime installed
along with the current GeForce driver from nVidia.com.
thanks il pass that on,
itl be useful if it does and it works with xna,
it reports it has pixel shader 1.1 or higher so it should do.

I duno why I didnt check if they had latest drivers.
most of the hits for ti 4200 mention only directx8 support,
but I gues they are just old pages.

Colin =^.^=
Dec 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample code for Encrypting some file using...
1
by: Mike | last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta; frameworkv2.0.50215 ) the source code below I get errors (listed below due to the use of ICallBackEventHandler. Ultimately I...
10
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.