MFC + DirectX Render Problem

Started by
5 comments, last by Evil Steve 15 years, 9 months ago
Hi everybody, I'm programming a development tool that uses the Microsoft Foundation Classes (MFC) and DirectX 9.0. It has a render view. At first I used a LPD3DXMESH teapot to test I could paint a 3d scene right. Later I changed to my own proprietary format and then the view doesn't update itself properly.( At the begining of the app shows my mesh, but when I minimize and maximize keeps the others window aspect) I changed the Directx to debug mode and a break is thrown in this code of the cmdtarg.cpp file: case AfxSigCmd_v: // normal command or control notification ASSERT(CN_COMMAND == 0); // CN_COMMAND same as BN_CLICKED ASSERT(pExtra == NULL); (pTarget->*mmf.pfnCmd_v_v)(); break; I tested my mesh format in other project and works right. I don't know what to do. Someone can help me? (sorry if my english is a bit bad)
Advertisement
What do the Debug runtimes say? What do you mean by "when I minimize and maximize keeps the others window aspect"? What other window? What sort of debug break do you get there? What line? What's the error you get in the debug spew?
Uhm, the debug runtime shows the following error

Direct3D9: (ERROR) :Texture not created with this device. SetTexture failed.

The break message showed by VC is the following

MFC.exe has triggered a breakpoint

And I try to explain that when I minimize and maximize my app and I have other windows opened the render view of my app gets the image of the others window (doesn't update itself)
Do you proper handle the lost device case?

What exactly happens when the device is lost? Do you release all non-managed-pool resources and recreate them after the reset?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Quote:Original post by Ravnock
Uhm, the debug runtime shows the following error

Direct3D9: (ERROR) :Texture not created with this device. SetTexture failed.
Are you using multiple devices? That's usually A Bad Thing, might show up driver bugs (Multiple devices isn't a common scenario and probably isn't tested as well as other methods), and is slower than using a single device. If not, it sounds like you have some weird memory corruption going on.

Quote:Original post by Ravnock
The break message showed by VC is the following

MFC.exe has triggered a breakpoint
On what line? Is there anything else in the debug output above that? E.g. any errors or exceptions?

Quote:Original post by Ravnock
And I try to explain that when I minimize and maximize my app and I have other windows opened the render view of my app gets the image of the others window (doesn't update itself)
That sounds to me like Present() is failing, or you're not updating somehow. Nothing will be getting drawn to the window, so it won't be redrawn and will show whatever was over the window before it.
I think the update is doing right, because if I change from my mesh to LPD3DXMESH, LPD3DXMESH updates right.

I will check if there are bad pointers. And I will look for the texture error reason.

Thank you for all
Quote:Original post by Ravnock
I think the update is doing right, because if I change from my mesh to LPD3DXMESH, LPD3DXMESH updates right.

I will check if there are bad pointers. And I will look for the texture error reason.

Thank you for all
I'd suggest cutting out parts of your mesh code until it magically starts working again, then you'll know what's causing the problem. If it works with the D3DX mesh, then it's almost definitely a problem with your custom mesh code.

This topic is closed to new replies.

Advertisement