Direct3D Interface Problem

Started by
3 comments, last by rroach 24 years ago
I have run into an error and was hoping someone would have some insight. Basically, I create a direct draw object and then attempt to create the d3d device. When I try to create the d3d device, I get a linker error that states that ddraw does not recognize the given interface. But I think the problem is arising in the call creating the direct 3d device. The pointer is still set to null(0) when the call returns. I am at work so I don''t remeber exactly what I wrote but it is basically directdraw7->QueryInterface(IID_IDirect3DDevice, &d3dPointer) where d3d pointer is an LPDIRECT3DDEVICE (I think). I have not tried to trash the INITGUID and link with the dxgiud.lib but this should be equivalent, as far as I know.
Advertisement
your problem is that u try to create the d3d device before u create the d3d object to create d3d object do that:

LPDIRECT3D7 D3DObj = NULL;
hRet = DDrawObj->QueryInterface(IID_IDirect3D7, (void **)&D3DObj);

and then create the d3d device:

LPDIRECT3DDEVICE7 D3DDevice = NULL;
hRet = D3DObj->CreateDevice(IID_IDirect3DHALDevice, RenderSurface, &D3DDevice);


------------------------------- Goblineye Entertainment------------------------------

very important:
before u create the d3d device u need to create the primary surface and the render surface, the render surface is ddraw surface that u do ot it all the render stuff...

------------------------------- Goblineye Entertainment------------------------------

In response:

LPDIRECT3D7 D3DObj = NULL;
hRet = DDrawObj->QueryInterface(IID_IDirect3D7, (void **)&D3DObj);

This is what I am doing. I am not looking at the code now so I got it backwards. It is in the QueryInterface call that the problem is. When this call returns the pointer D3DObj is still null(0, so basically it is never being assigned. So when the next call is made, of course I get an exception that kills the program. Problem is I cannot figure out why this is happening.
can u post the orginal code here?
so i can check it??
it will very help.

thanks

------------------------------- Goblineye Entertainment------------------------------

This topic is closed to new replies.

Advertisement