New to Managed DirectX

israel

Newcomer
Joined
Aug 5, 2004
Messages
17
I just downloaded managed directX and I’m trying to run my first application but I cannot even create the device. I always get this error (with another six that I think are related)

error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::IDirect3DDevice9': undefined native type used in 'Microsoft::DirectX::Direct3D::Device'; imported native types must be defined in the importing source code

Does anybody know what I’m doing wrong?

My code is in the txt file attached

Thanx
 
Last edited by a moderator:
eh?
Send a few snippets of your code rather than a doc, right when you declare your Device and when you instantiate it should be fine.

Don't give up on MDX :),
Its hard to get started, I agree - it took me about a half-a-year to get my thoughts organized o_O, and things started to click.

Well anyways - send snippets of your code, and tell us what DLLs (actually they're .libs in C++ arent they?) you imported.

-Pent
 
Thanx for the support

This is what I have.

private:
Device* device;


public:
bool InitializeGraphics()
{
PresentParameters* pres = new PresentParameters();

pres->Windowed = true;
pres->SwapEffect = SwapEffect::Discard;
device = new Device(0, DeviceType::Hardware, this, CreateFlags::SoftwareVertexProcessing, pres);
return true;
}


I get an error when creating the device.
I have references to
Microsoft.DirectX.Direct3D
Microsoft.DirectX
Micosoft.DirectX.Direct3DX.
And I also included the namesaces
using namespace Microsoft::DirectX;
using namespace Microsoft::DirectX::Direct3D;
 
It seems to me that you're not setting enough flags for the PresentParameters. Mine looks something like this (just ignore the vb and look at the main source :):

Protected D3Dpp As PresentParameters = Nothing
Protected DP As DisplayMode = Nothing

DP = Manager.Adapters.Default.CurrentDisplayMode

D3Dpp = New PresentParameters()
D3Dpp.BackBufferFormat = DP.Format
D3Dpp.BackBufferWidth = DP.Width
D3Dpp.BackBufferHeight = DP.Height
D3Dpp.SwapEffect = SwapEffect.Discard
D3Dpp.PresentationInterval = PresentInterval.Immediate

D3Dpp.Windowed =
True


Also, shouldn't the argument for instantiating the device be, "this.Handle" or your hWnd? (I'm not sure if it is in C++)

If that doesn't help, what does the error say? Maybe then we can help you more.

-The Pentium Guy
 
Thank you

Thanks a lot, but my problem is that it seems like the syntax for MC++ is slightly different from the syntax in VB or C#; and I’ve found almost nothing about MC++ and Managed DirectX, not even in the msdn

I found a snippet of code but it doesn’t compile either. Here’s what I found:

public: bool InitializeGraphics(void)
{
try
{
// Now let's setup our D3D stuff
PresentParameters *presentParams[] = new PresentParameters *[1];

presentParams[0] = new PresentParameters;

presentParams[0]->Windowed = true;
presentParams[0]->SwapEffect = SwapEffect::Discard;
device = new Device(0, DeviceType::Hardware, this->get_Handle(),
CreateFlags::SoftwareVertexProcessing, presentParams );
return true;
}
 
Could you please specifically state the error?
Also, I don't know why the PresentParams is an array (maybe it's supposed to be in C++?)
What's the error in your code?

-The Pentium Guy
 
Here are some of my errors I'm getting

Yes, as far as I know in MC++ the PresentParameters is an array. There's a few differences from VB and CSharp.

error C3635: 'Microsoft.DirectX.PrivateImplementationDetails.IDirect3DDevice9': undefined native type used in 'Microsoft.DirectX.Direct3D.Device'; imported native types must be defined in the importing source code

error C3377: 'Microsoft.DirectX.Direct3D:Device..ctor' : cannot import method - a parameter type or the return type is inaccessible

Note:
I changed the :: for . because it was not letting me post the reply
 
Thx

Thanks man, I’m writing some examples in C# now but before I work on the definitive application I’m giving one more try to MC++

Thanks
 
Back
Top