Jump to content
  • Advertisement
Sign in to follow this  
Say

Where do i wrong?

This topic is 4828 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

1) Looking to my code is it a correct use of swap chains?
				// Draw within panel1
				Surface pBackBuffer = sc_0.GetBackBuffer(0, BackBufferType.Mono);
				//device.SetRenderTarget( 0, pBackBuffer );

				//Clear the backbuffer to a blue color
				device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.DarkGray, 1.0f, 0);			
				device.BeginScene();
				// Setup the world, view, and projection matrices
				SetupMatrices();
        
				for( int i=0; i<meshMaterials.Length; i++ )
				{
					// Set the material and texture for this subset
					device.Material = meshMaterials;
					device.SetTexture(0, meshTextures);
    
					// Draw the mesh subset
					mesh.DrawSubset(i);
				}

				//End the scene
				device.EndScene();
				sc_0.Present(panel1);
				//device.Present();
				pBackBuffer.ReleaseGraphics();/**/

				// Draw within panel2
				Surface pBackBuffer2 = sc_1.GetBackBuffer(0, BackBufferType.Mono);
				device.SetRenderTarget( 0, pBackBuffer2 );

				//Clear the backbuffer to a blue color
				device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.DarkGray, 1.0f, 0);
				device.BeginScene();
				// Setup the world, view, and projection matrices
				SetupMatrices();
        
				// Meshes are divided into subsets, one for each material. Render them in
				// a loop
				for( int i=0; i<meshMaterials.Length; i++ )
				{
					// Set the material and texture for this subset
					device.Material = meshMaterials;
					device.SetTexture(0, meshTextures);
    
					// Draw the mesh subset
					mesh.DrawSubset(i);
				}

				//End the scene
				device.EndScene();
				sc_1.Present(panel2);
				pBackBuffer2.ReleaseGraphics();
2) Other question: I set a second buffer ( swap chain ) to draw in onResetDevice function, i create a new PresentParameter to define a new dimension for a backbuffer all time the window is resized, but the backbuffer seems remain always at the same dimension, infact in i maximise the window the mesh is stretched and it became blur. Where do i yet wrong here?
		public void OnResetDevice(object sender, EventArgs e)
		{
			sc_0 = device.GetSwapChain(0);
			presentParams2.Windowed = true;
			presentParams2.SwapEffect = SwapEffect.Discard;
			DisplayMode mode = new DisplayMode();

			presentParams2.BackBufferFormat = mode.Format;
			presentParams2.BackBufferWidth = mode.Width;
			presentParams2.BackBufferHeight = mode.Height;
			presentParams2.EnableAutoDepthStencil = true;
			presentParams2.AutoDepthStencilFormat = DepthFormat.D16;
			sc_1 = new SwapChain(device, presentParams2);
			device.RenderState.ZBufferEnable = true;
			device.RenderState.Ambient = System.Drawing.Color.White;
		}
[Edited by - Say on July 31, 2005 6:52:18 PM]

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!