Swap Chains

elikakohen

Newcomer
Joined
Sep 16, 2003
Messages
13
Location
USA
Just wondering if someone could help me with understanding swap chains...

Are these true?
-A Device can have many swap chains.
-Swap Chains can have multiple other Swap Chains
-Swap Chains can have multiple "View Ports"

These are the assumptions that I have been working under but I can not get any swap chains to work...

I think my problem is in this code...

/*************************************************/
private static void SetRenderTarget(Control view)
{
SwapChain newSwapChain;
Surface renderTarget;

// Copying the Device's Presentation Parameters...
PresentParameters pp = device.PresentationParameters;

// Customizing Presentation Parameters for this view
// Setting the Device window to be associated with a .NET control
pp.DeviceWindow = view;
pp.BackBufferHeight = view.Height;
pp.BackBufferWidth = view.Width;

// newSwapChain = device.GetSwapChain(0); // This works

// Attempting to create a new Swap Chain
newSwapChain = new SwapChain(device, pp); // This doesn't

// Trying to get the new Surface from the chain.
renderTarget = newSwapChain.GetBackBuffer(0,BackBufferType.Mono);

// Getting a Depth Stencil... (The same as the Device's)
device.DepthStencilSurface = GetDepthStencil();

// Vainly attempting to make this swap chain the target.
device.SetRenderTarget(0, renderTarget);

// It might be a good idea to dispose this..
// renderTarget.Dispose();
}


However, I am beginning to think it is with the device.BeginScene(), EndScene, and Present() functions... I am supposed to call these off of the main device and not the Swap Chains or Surfaces right?

Thanks for the help.
 
Back
Top