Jump to content
  • Advertisement
Sign in to follow this  
load_bitmap_file

Direct3D Lost Device

This topic is 4733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am trying to test to see if the Direct3D 9 device has been lost and if so, reset it. I ran my fullscreen program and alt tabbed out, then alt tabbed back in, but my device wasn't being reset. The problem was that my calls to IDirect3DDevice9::TestCooperativeLevel() were constantly returning D3DERR_DEVICELOST even though I had freed all my D3DPOOL_DEFAULT resources, so I ran it through the DirectX debugger and got this:
Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails
Does anyone know how to fix this? I would guess that means I need to capture the WM_ACTIVE message in my window-message-checking loop and do something with that, but I don't know what exactly to do. Please help!

Share this post


Link to post
Share on other sites
Advertisement
Tbh, I can never remember the exact code as I don't have to write it very often. You need to IDirect3DDevice9::Reset() your device and then re-create all your resources.

Your best reference for this is the DXSDK sample framework, it's pretty much the text-book way to handle any/every state.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
Tbh, I can never remember the exact code as I don't have to write it very often. You need to IDirect3DDevice9::Reset() your device and then re-create all your resources.

Your best reference for this is the DXSDK sample framework, it's pretty much the text-book way to handle any/every state.

hth
Jack


Well, I can't Reset() yet because TestCooperativeLevel() is failing because my "window does not have focus", which means I cannot know when it's safe to Reset()! I'll see if sample framework turns up anything though.

EDIT: Ack, I can't find anything. I'm not very good at reading other peoples' code. [sad]

Share this post


Link to post
Share on other sites
Quote:
Original post by Talib
Hi, had a similar problem a while back ... too long ago for me to remember, but here's my post, hope it helps:

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


Yup, same exact problem here. I actually just figured it out a minute ago! I forgot to call my window's HandleMessages() so it couldn't refocus on the window. A cookie for you anyway [smile].

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!