Direct Draw... problem
Hi everybody!
I have a serious direct draw problem.
I have made a fullscreen app. I have 1 buffer for the screen for fliping.
I tried to change the resolution and then recreate the screen surfaces (primary and buffer).
If I run the exe it creates the two surfaces successfuly.
After changing the resolustion, it (releases first)recreates the two surfaces without any error values return. However, when trying to write into the surfaces (by using lock) the app crashes.
If I run the same app with visulc''s debug, it works good.
If I run the app without debug, but do the proccess of recreating the surfaces twice (meaning... relase, create, release, create) then it works good as well.
This phenomena happens only on one of my old screen adapters. On my new screen adapter it works good without doing the "proccess" twice.
I would appreciate any help on this matter.
Thanks in advance.
When you change the resolution and write on the surface again, are you writing in bounds still? For example, if you have your resolution at 800x600 and write to "p_vidMemory[(799 * 600) + 599]" if would write to the last pixel. If you changed your resolution to 640x480 and tried to write to the same place you''d crash the program because you''d write past the array.
***********************
***********************
dont forget to use the pitch value to acces things, and dont simply divide it to fit things (ie divide by 2 for a 16bit color depth). it SHOULD be ok to od that, but all drivers find that acceptable. also you are using the correct bounds right? ie when you switch res, you use that bound res.
are you sure that on release you set the pointer to null? make sure you check all error messages. possible lock() is not working.
never trust debug, its safer and tends to hide buffer overflows and other wierdness.
are you sure that on release you set the pointer to null? make sure you check all error messages. possible lock() is not working.
never trust debug, its safer and tends to hide buffer overflows and other wierdness.
its not required, but helps let you know if you released the object or not. thus making things easier to debug.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement