Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use DXUT framework with WPF/D3DImage?

44 views
Skip to first unread message

Stollak@discussions.microsoft.com DP Stollak

unread,
Dec 2, 2009, 2:01:01 PM12/2/09
to
I'd *really* like to use the arcball and font tools from the DXUT toolkit,
and I have already written my app from the SimpleSample C++ sample code,
adding on things, removing things, etc. as a proof-of-concept.

Now I need to get that same app into WPF dialog using D3DImage.
I already did
http://msdn.microsoft.com/en-us/library/cc656785.aspx
and something similar to
http://blogs.msdn.com/nickkramer/archive/2006/03/18/554235.aspx
to get mouse messages passed to the framework, and then my g_Camera
(CModelViewerCamera) is working.

Now I'm calling the following:

hr= DXUTSetWindow(m_hwnd, m_hwnd, m_hwnd, true);
in my CRendererManager::EnsureHWND() call (if the window's created),

hr=DXUTSetD3D9Device(m_pd3dDevice)
in my CRenderer::Init

and
DXUTSetD3D9Device(m_pd3dDevice);
DXUTSetCallbackFrameMove( OnFrameMove );
DXUTSetCallbackDeviceChanging( ModifyDeviceSettings );
DXUTSetCallbackD3D9DeviceReset( OnD3D9ResetDevice);
DXUTSetCallbackD3D9DeviceCreated( OnD3D9CreateDevice);
in CPosRenderer, the class I derived from CRenderer (much like
CTriangleRenderer in the walkthrough), with those functions brought over from
my SimpleSample-based code.

Something is wrong. I'm getting messages in OnD3D9ResetDevice where the
window size is CLEARLY not the size of the airspace for my D3D content in my
WPF dialog box (512x512-ish). First it comes through with a backbuffer of
dimensions (1,1), then (184,164), a dialog box error message about my device
having a non-0 reference count (which makes sense, since I haven't moved the
other callbacks) with a little plain window off in the corner. Also, it's
getting to become a big mess.

What part(s) am I doing wrong? My guess is that I'm trying to use a
placeholder window instead of the D3DImage-sourced Image's window, but...
(shakes head) there's so much "this seems to work, let's try it" code that
I'm at a loss where to go next.

0 new messages