Jump to content
  • Advertisement
Sign in to follow this  

[MDX] Swapchains painting on wrong Panels

This topic is 4483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, as a followup to this, I have run into a strange set of problems when it comes to displaying my scene from several angles. I have a 4 way panel, which is made of a SplitContainer, and each Panel containing another SplitContainer. The Panels in these left and right containers all hold a CustomViewport, which basically contains a Camera and SwapChain, along with some other irrelevant stuff. As its an editor I'm making and not the game engine, I force all of the views to update via the click event on the main form. This does display the contents of the views, but not on the correct panel. When working correctly, it should be displaying them in clockwise order of top, right, 3d and centre order (or 1, 2, 3, 4 for simplicity), but instead shows them in 3d, front, right, top order (3, 4, 2, 1). Now, I know for a fact that they are hooked onto the correct panels inside the SplitContainer, as I have checked via the code generated and the designer, so I'm stumped as to why its showing up in the wrong place. Has anyone ever come across anything like this using swapchains, or is it nothing to do with them at all? And to make it even more confusing, I attached another onclick listener to the bottom right view, which is rightViewport.Panel2, which simply rotates the camera that *should* be there (the 3d perspective one) around the target by a small amount. When I click on it, the correct 3d view magically appears, but when I click again on the main form, and cause all views to be redrawn, this correct view jumps up to the top left panel and is replaced by the original incorrect one. A possibly related problem is that I have to click twice on the main form (and therefore call the function which paints the views twice), in order to get the top left panel to paint correctly (which should be the top view but instead is the 3d view). So, there's something to chew over. Apologies for the uber long post. [Edited by - dpattiso on September 9, 2006 11:23:34 AM]

Share this post

Link to post
Share on other sites
Hmmm, you can probably ignore most of that crap up there, as a bit more tinkering has provided a more succinct description.

Its something to do with the way or order of the swapchain's rendering. If I render a single view only, it works, but introducing others makes the views get confused and puts them in the wrong place. Although, by manually telling each view to refresh, they do eventually end up in the same place. Is this something to do with the fact I only call the view's render function once here, and 4 times on a "full" refresh?

Heres the code for the render method, which is held within a CustomViewport class.

private void RenderViewport(CustomViewport viewport)

device.RenderState.CullMode = Cull.None;

Mesh m = Mesh.Teapot(device);
Material mat = new Material();
mat.Ambient = Color.Red;
mat.Diffuse = Color.Silver;
mat.Specular = Color.White;
device.Material = mat;




Note that the calls to EndScene(), Present() and Clear() simply call the same method on the Device object held by the CustomViewport (or the SwapChain in the case of Present()).

The CustomViewport.BeginScene() function just calls

public void BeginScene()
device.SetRenderTarget(0, swapChain.GetBackBuffer(0, BackBufferType.Mono));

Is there something else I should be doing with the SwapChain objects, or a missing PresentParameter?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!