Skip to main content
gamedev.net
🔒 Locked

Direct3D Interface Problem

Started by rroach Apr 21, 2000 at 9:37 AM 3 replies 700+ views
Original Post
rroach
rroach
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.
Xeno
Xeno
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------------------------------
Xeno
Xeno
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------------------------------
rroach
rroach
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.
Xeno
Xeno
can u post the orginal code here?
so i can check it??
it will very help.

thanks
------------------------------- Goblineye Entertainment------------------------------

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.