Jump to content
  • Advertisement
Sign in to follow this  
Say

mesh is crash rendered?

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

if you se this image: http://www.freestylebitonto.com/backup/tiger.jpeg you cna see how my mesh is rendered. What i could wrong? I use directx-c#-swapchains and this is the second backbuffer (the first is rendered correctly). tnx

Share this post


Link to post
Share on other sites
Advertisement
maybe the problem stay in these rows:

Surface pBackBuffer2 = swapchain_1.GetBackBuffer(0, BackBufferType.Mono);
device.SetRenderTarget( 0, pBackBuffer2 );


i've create the second swapchain in this way:

presentParams[1].Windowed = true;
presentParams[1].SwapEffect = SwapEffect.Copy;

presentParams[1].BackBufferFormat = mode.Format;
presentParams[1].BackBufferWidth = panel2.Width;
presentParams[1].BackBufferHeight = panel2.Height;
presentParams[1].EnableAutoDepthStencil = true;
presentParams[1].AutoDepthStencilFormat = DepthFormat.D16;
swapchain_1 = new SwapChain(device, presentParams[1]);

Share this post


Link to post
Share on other sites
i've checked again, these rows are not the problem.
So in your opinion where the problem could be?

Share this post


Link to post
Share on other sites
sorry friend i'm a newbie, where and with what function i clear it?
this is my render code:


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();

// 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
((XFileObject)x_file_list[0]).xMesh.DrawSubset(i);
}


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

// 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
((XFileObject)x_file_list[0]).xMesh.DrawSubset(i);
}


//End the scene
device.EndScene();
//device.Present();

sc_1.Present(panel2);
pBackBuffer2.ReleaseGraphics();


maybe you mean at pBackBuffer.ReleaseGraphics(); and pBackBuffer2.ReleaseGraphics();

Share this post


Link to post
Share on other sites
You are clearing the depth buffer, the following line is where it happens (twice):

device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.DarkGray, 1.0f, 0);

The highlighted flag is indicating that you clear the Z/Depth buffer.

Do you get the same results if you use the reference rasterizer?

I can't see anything obviously wrong with that fragment of code. Although, as Syranide asked - is it a static or animating pattern of distortion?

hth
Jack

PS - would you use [ source ] ... [ / source ] (without spaces) tags next time [smile]

Share this post


Link to post
Share on other sites
thank you for your interesting...
What does mean "static or animating pattern of distortion"?
How do i use "reference rasterizer"?

Sorry about my ignorance!

Share this post


Link to post
Share on other sites
Quote:
Original post by Say
What does mean "static or animating pattern of distortion"?

Is the pattern (that you showed us in your screenshot) the same on *every* frame, or does it change with time? If you rotate your model (etc..) does that cause the pattern to change?

Quote:
Original post by Say
How do i use "reference rasterizer"?

You need to specify D3DDEVTYPE_REF in your IDirect3D9::CreateDevice() call. Typically it'll replace the parameter that is set to D3DDEVTYPE_HAL.

hth
Jack

Share this post


Link to post
Share on other sites
no it doesn't animate.
my code was:
device = new Device(0, DeviceType.Hardware, this.panel1, flags, presentParams[0]);
i've now tried to change with:
device = new Device(0, DeviceType.Reference, this.panel1, flags, presentParams[0]);

but it is the same! :(

Share this post


Link to post
Share on other sites
ok now i've tried to replace with this and it works:
device = new Device(0, DeviceType.Hardware, this, flags, presentParams[0]);

but the two meshes rendered in the two windows (precisely form' panels) are stretched. why?

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.

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!