Skip to main content
gamedev.net
🔒 Locked

DirectX Fullscreen Problem

Started by salocinx 3 replies 2.5k views
Original Post
salocinx
salocinx
Hi

I am new to Managed DirectX programming (C#) and have probably just encountered a newbie problem, but I realy didn't found any solution to it the last 5 hours. So I would be very glad if somebody could help me out.

I implemented a basic fullscreen Direct3D form as it is suggested by many tutorials. But as soon as I switch the application into fullscreen mode, I get the following error message when starting in debug-mode:

Microsoft.DirectX.Direct3D.InvalidCallException: Error in the application.
at Microsoft.DirectX.Direct3D.Device.Reset
at Microsoft.DirectX.Direct3D.Device.OnParentResized
...etc...

As suggested by the sample-code, I regulary call Application.DoEvents() in the main-loop so that windows might handle the event-queues and so on... if I understand this right...

But exactly here is the problem. If I switch off the DoEvents()-call, the application just starts fine in fullscreen mode, but it does not react on key-strokes anymore and I have to shutdown the app by the Task-manager everytime.

Could anybody please help me? I am going to freak out ... :-(
Evil Steve
Evil Steve
What do the Debug Runtimes say? I suspect you're not releasing all your default pool resources before calling Reset() - that's the usual reason for Reset() failing with InvalidCallException.
salocinx
salocinx
Hi Evil Steve

Thank you for the fast reply. It took me some time to install the debugger. When I start the app now, I get the following message:

An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in Microsoft.DirectX.Direct3D.dll

Additional information: Error in the application.

Did I install the Debug-Runtimes wrong? Since the error-message is now smaller than before ;-)

I have this problem only in fullscreen-mode when I call Application.DoEvents() in the main-loop.

So what is the story with the default pool resources? Do I have to handle this different between fullscreen and windowed Directx apps?
salocinx
salocinx
By the way, I tried to handle the reset-event by adding the following to my code:

m_device.DeviceReset += new EventHandler(this.OnResetDevice);

public void OnResetDevice(object sender, EventArgs e) { ... }

Should I instantiate all related DirectX objects within this method?

Sorry for these newbie questions...
Evil Steve
Evil Steve
Quote:
Original post by salocinx
Did I install the Debug-Runtimes wrong? Since the error-message is now smaller than before ;-)
From the link above:
Quote:
From sirrob:
Under Managed Projects, you need to select "Enable unmanaged debugging" in the Debug section of the project properties. If you're running C# Express 2005, you cannot view the debug output using VS, and would need to use an external tool to catch debug output (like sysinternals' dbgview).


Quote:
Original post by salocinx
So what is the story with the default pool resources? Do I have to handle this different between fullscreen and windowed Directx apps?
Before you reset the device, you need to release all default pool resources, because VRAM is about to "go away". I'm not sure why it'd work without the DoEvents call though (I'm not a C# person).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.