Resize crash, directx bug? (c#)

Started by
7 comments, last by Miksan 20 years, 5 months ago
I created a very simple program, which calls Clear, BeginScene and EndScene. If I resize the form from the left bottom corner up to the right top corner, the program crashes. Is this normal?
Advertisement
Do you also call present ?
if he didnt call present i dont think it would necessarily crash the app, it just wouldnt show anything in the window.

but it could be.

try stepping through the application and seeing where it bombs, or set break points and see if you can reach them.
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
Do you handle your resize properly, not setting the viewport to a zero height/width?
A polar bear is a rectangular bear after a coordinate transform.
Sorry, forgot to mention Present. I'm not doing anything else, and the exception message says "Error in application" and stack trace goes to DirectX's Reset method.

edit: What am I doing wrong? In the fullscreen mode when I move the mouse to the screen edge, cursor changes to a drag arrow. I can drag the edge of the "fullscreen" and the program crashes! Here's my dx initialization:

AdapterInformation ai = Direct3D.Manager.Adapters[0];_pp.BackBufferFormat = ai.CurrentDisplayMode.Format;_pp.BackBufferWidth = bWindowed ? 0 : form.Width;_pp.BackBufferHeight = bWindowed ? 0 : form.Height;_pp.BackBufferCount = 1;_pp.DeviceWindow = form;_pp.Windowed = bWindowed;_pp.PresentationInterval = PresentInterval.Default;_pp.SwapEffect = SwapEffect.Discard;_pp.AutoDepthStencilFormat = DepthFormat.D16;_pp.EnableAutoDepthStencil = true;_pp.FullScreenRefreshRateInHz = bWindowed ? 0 : iRefreshRate;_pp.MultiSample = Direct3D.MultiSampleType.None;


[edited by - Miksan on November 11, 2003 12:44:18 PM]
this will solve it. But I don''t know what the cause of it is though, if you find out, let me know please.

protected override void OnResize(EventArgs e)	{		try		{			base.OnResize (e);		}		catch		{		}	}
Did you try releaseing all DEFAULT pool resources before calling Reset ? If you don't, your program will crash.


[edited by - Coincoin on November 11, 2003 6:47:23 PM]
Editor42 ...builds worlds
quote:Original post by Coincoin
Did you try releaseing all DEFAULT pool resources before calling Reset ? If you don''t, your program will crash.


What would they be is such small program? I''ve only got this Device, but I think it shouldn''t be released...?

im not really sure why this is such a big problem all you have to do is this
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
if(Device != null)
{
Device.Dispose();
Device = null;
Device.Reset();
}
}

it works everytime for me, i have never had any problems with resizeing. If you want to have it still work after minimizeing you have to do a few other tricks, right now i cant put my laptop on the network here(School has Data Nazi Net Admins) but when i get home i will upload my tutorial on managed Direct3D, to some free web service or i can just e-mail it to you, if thats the case my e-mail is hippiehunter@msn.com

This topic is closed to new replies.

Advertisement