Sign in to follow this  
lemmy101

D3DERR_DEVICELOST when screen res changes

Recommended Posts

Hi all, I am using direct3D to blit particle effects onto a game engine that does not use Direct3D (It's 2D for a start). i've got this working fine in windowed, by blitting the game screen to an invisible hWnd set up with Direct3D, rendering the effects, then blitting back again before returning into the 2D game engine to draw the HUD etc. The problem is, if I set the game to be in fullscreen (320x200x32) the effects dissapear (though the blitting back and forth to the D3d window and the game window still works fine , Direct3DDevice->ValidateDevice returns D3DERR_DEVICELOST, and no amount of calling Reset with any pixel format or anything seems to work. I have my presentation details set to windowed, X8R8G8B8 (the pixel format is shared by the game engine which is why I've chosen it), so maybe the problem is D3D can't cope in that resolution, or loses control of the device. Though if I set it to be fullscreen presentation settings it crashes out straight away, obviously not being able to cope with something else changing the res and drawing to the screen. Actually delaying the D3DDevice creation until after the res change and I can't get it to work at all. Is there any way at all around this? :( All our effects pretty much rest on their being a solution. yours hopefully, lemmy

Share this post


Link to post
Share on other sites
I think the problem is that you're using an invisible hWnd to render D3D to. D3D won't really like that very much.
You'll get a device lost error if D3D doesn't have the focus; I.e. another app is getting used.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
I think the problem is that you're using an invisible hWnd to render D3D to. D3D won't really like that very much.
You'll get a device lost error if D3D doesn't have the focus; I.e. another app is getting used.


Though it works fine in windowed with the invisible hWnd? If this is so does it basically mean there's nothing we can do? :-\

Share this post


Link to post
Share on other sites
If another window has fullscreen focus, then D3D doesn't get access to video memory.

Are you mixing DirectDraw and Direct3D or something? Why not just render directly to your output window?

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
If another window has fullscreen focus, then D3D doesn't get access to video memory.

Are you mixing DirectDraw and Direct3D or something? Why not just render directly to your output window?


Because we are using a point-and-click adventure game studio called AGS, which is awesome, and it has plug-in support with callbacks on events like POSTSCREENDRAW and PRESCREENDRAW that I hook into. Hence I have no direct control over the main window.

I tried setting Direct3D to draw onto the main window, but ended up with loads of flickering... I made another post about it here:

http://www.gamedev.net/community/forums/topic.asp?topic_id=380111

but no one seemed to have a solution to it, so I've gone the invisible window route.

Cheers,

lemmy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this