Skip to main content
gamedev.net
🔒 Locked

DirectX in partial window

Started by CTEagle Aug 15, 2006 at 11:17 AM 4 replies 600+ views
Original Post
CTEagle
CTEagle
Is it possible to have a directX "window" on a form. For example, if I have a form that takes up my entire screen(1280x1024), can I have directX "window" on that form that is say 800x600? If this is possible, how would I go about doing it? Thanks in advance.
Agony
Agony
You could easily do this by adding a child window, in the form of an image box, panel, or other similar control (depending on what you're using, VB6, MFC, .NET, et cetera), and then using that control's HWND as the window that you tell Direct3D to draw to. Then you can resize and position that control however you want. (Note that if you don't make Direct3D's backbuffer match in size, you'll get filtering on the final result, distorting the image.)
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
CTEagle
CTEagle
Thanks for the quick reply Agony. Just a quick follow-up. Would a "STATIC" window work as my "child" window? (VS2005 C++, DirectX 9)
CTEagle
CTEagle
I just tested this using a "STATIC" window and it does work. Thanks again.
CTEagle
CTEagle
I just tested this using a "STATIC" window and it does work. Thanks again.
hplus0603
hplus0603
If using Win32, I would register a new window class which "does nothing" except call DefWindowProc, and then pass the HWND of that into the call to Present().

If using WinForms, I would use a Panel (which is a blank child window) and pass its Handle into the Device.Present call to present an image into the Panel.

Make sure that you size the back buffer and viewport correctly for the child window. What I do is create a back buffer the size of the entire screen, so that I know I can handle the largest possible window without needing to re-allocate anything.
enum Bool { True, False, FileNotFound };

Topic Locked

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

Sign in to reply to this topic.