LockRectangle error

EFileTahi-A

Well-known member
Joined
Aug 8, 2004
Messages
539
Location
Portugal / Barreiro
I simply cant understand why this does not work...

Code:
Surface s = dxDevice.GetBackBuffer(0, 0, BackBufferType.Mono);
GraphicsStream gs = s.LockRectangle(LockFlags.ReadOnly);

It gives me an error when executing the second line of code. Ive tryed using many different parameters but, always give me "Error-in-application".

Why is this happening?
 
Have you trie drunning with the debug version of DirectX enabled and getting using its d3dspy.exe to see what is happening under the hood?
 
Well, I discovered the problem, I needed to add the following lines to the Device Parameters:

Code:
presentParamsDX1.SwapEffect = SwapEffect.Discard;
presentParamsDX1.EnableAutoDepthStencil = false;
presentParamsDX1.PresentFlag |= PresentFlag.LockableBackBuffer;
presentParamsDX1.MultiSample = MultiSampleType.None;

And it works fine :)
 
Back
Top