Re: How to Imlement DeviceReset (Light is Lost on Window Resize)

"bazad" <no reply> wrote in message news:0DDA88D5-5BD6-47BA-B030-9962BC20250E@xxxxxxxxxxxxxxxx
"ZMan" <zman@xxxxxxxxxxxxxx> wrote in message news:ugYAyy%23aHHA.3272@xxxxxxxxxxxxxxxxxxxxxxx
If you take a look at code attached you would see that graphics initialization is very simple. All other resources are created inside paint method and thus are recreated every time. Here is all I do to initialize graphics:

In general people do not have time to open up projects and debug them for people. Running random code on our machines is a potential nightmare.

Take a look at the tutorials 1-5 in the SDK. They draw simple triangles and shapes and handle Device Reset properly. What do they do differently.

I already did.

Tutorial 1 - no reset at all
Tutorial 2 - no reset at all

Tutorial 3 - there is reset
Device dev = (Device)sender;
// Turn off culling, so we see the front and back of the triangle
dev.RenderState.CullMode = Cull.None;
// Turn off D3D lighting, since we are providing our own vertex colors
dev.RenderState.Lighting = false;
If I try this on my code it does not work, but it works in their sample. I guess I will try to see what's the difference is.

Uh, so much to learn from a book by Bob Gaines "Managed DirectX 9 Graphics and Game Programming".

well, I replied too soon. Tutorial 3 uses no lights that's why the code works (no black triangle issue like I have).

Wait a minute. Tutorial 4 uses lights and it demonstrates the issue I am complaining about! Here we go back to my problem.

Tutorial 5 uses lights and has no problem, but they use Texture if there is any difference here.

So, how would one fix Tutorial 4 to work correctly on resize?