Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multi-viewport (diffrent windows)

Started by DanielH Aug 3, 2006 at 12:34 PM 2 replies 1k views
Original Post
DanielH
DanielH
Hi, I'm writing a world editor and I want to be able to render to 1, 2 or 4 diffrent viewports at the same time from the same device. I'm using MFC for the app. Making a new device for each viewport-view and then render is easy, but woulnd't that mean I'd have to create copies of the device objects (texture, vertex-, indexbuffers etc) for each viewport? That doesn't seem like a good solution for me :(
treeway
treeway
Your looking for swap-chains. Here's an example
http://www.mvps.org/directx/articles/rendering_to_multiple_windows.htm
Xetick
Xetick
If you use a new device for each view then yes. But there are better ways. It's called swapchains. For example code you can check out Codesamplers swap chain example

However do note that for an editor you should think about multimonitors. So if the window moves from one monitor to the next you need to recreate the device otherwise that window will become very slow. Personally I would use OpenGL and only support a single card with any number of monitors out from that card. That's what I'm doing in my own editor.
Plane9 - Home of the free scene based music visualizer and screensaver
hplus0603
hplus0603
You don't even need multiple swap chains. A given windowed device with a given swap chain can present to pretty much any window.

What I do is create the device with a backbuffer the size of the desktop, so I know I can render to any visible portion of any window. Then, when a 3D window gets a WM_PAINT, I render the appropriate scene to the back buffer, and Present() to the window in question.
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.