Archived

This topic is now archived and is closed to further replies.

Resize crash, directx bug? (c#)

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

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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
{
}
}

Share this post


Link to post
Share on other sites
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...?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites