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

Rendering windows on multiple monitors

Started by Michael Tanczos Aug 1, 2009 at 1:02 PM 0 replies 3.2k views
Original Post
Michael Tanczos
Michael Tanczos
I decided to create a new post for this particular issue since it is a different problem altogether (and one that I'm pretty concerned with that I don't really have options). I'm using a multi VMR9 setup where I'm rendering textures allocated from several different VMR9 instances to a window using textured quads. I'm trying to render the composited video (all videos mixed together) to a window that will be on one monitor. I'm also trying to render the individual video frames separately using viewports to a second window that must be displayed on an alternate monitor. I can create two windows on one monitor adapter and render the videos at full speed, but as soon as I move one of the videos to the other adapter the video rendering speed drops to a grinding halt as if it is rendering a frame every few seconds. Why is this and how can I resolve it? I'm unsure of a solution. Here are some options that I don't think are feasible: 1. Create multiple devices and attempt to somehow keep the vmr9 videos synchronized exactly. The downside is that performance degrades with the more videos you display and I'm not so certain that synchronization is even possible. 2. Use a multi-head setup.. But unfortunately I'm attempting to render the individual video frames separately to a non-fullscreen window that will dock inside a GDI+ based application. .. So, what else is there? Can a surface be converted to a bitmap to embed in my application quick enough to render 30 frames per second? Do swap chains work across multiple displays with real time rendering?
Michael Tanczos
Michael Tanczos
Since I only need to render a preview (screenshot) of what is on the full screen, I just did this:

// Create rendertarget texture in device memoryTexture _prvtexture = new Texture(_device, mode.Width, mode.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default);Surface _prvsurface = _prvtexture.GetSurfaceLevel(0);// Create an offscreen plain surface in system memory to copy toSurface _prvsurface_tmp = _device.CreateOffscreenPlainSurface(mode.Width, mode.Height, Format.A8R8G8B8, Pool.SystemMemory);_device.SetRenderTarget(0, _prvsurface);_device.BeginScene();// Render scene_device.EndScene();// Copy render target data from device memory to system memory_device.GetRenderTargetData(_prvsurface, _prvsurface_tmp);// Lock a rectangle on surfaceGraphicsStream g = _prvsurface_tmp.LockRectangle(LockFlags.None);// Allocate new bitmap using graphics stream internal dataSystem.Drawing.Bitmap bmp = new Bitmap(_prvsurface.Description.Width, _prvsurface.Description.Height, 4 * _prvsurface.Description.Width, System.Drawing.Imaging.PixelFormat.Format32bppArgb, g.InternalData);// Unlock surface_prvsurface_tmp.UnlockRectangle();// Copy a rectangle of size 800x200 to the PictureBox control_whateverControl.Image = (Bitmap)bmp.Clone(new Rectangle(0, 0, 800, 200), System.Drawing.Imaging.PixelFormat.Format32bppArgb);


- Michael

Topic Locked

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

Sign in to reply to this topic.