LockRectangle error

EFileTahi-A

Contributor
Joined
Aug 8, 2004
Location
Portugal / Barreiro
I simply can't 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. I've tryed using many different parameters but, always give me "Error-in-application".

Why is this happening?
 

EFileTahi-A

Contributor
Joined
Aug 8, 2004
Location
Portugal / Barreiro
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 :)
 
Top Bottom