• Advertisement
Sign in to follow this  

[MDX]AccessViolationException on Device.Clear

This topic is 3410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sometimes I'm getting AccessViolationException while executing Device.Clear()
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Black, 1.0f, 0);

and here is my device creation code:
ClientSize = new System.Drawing.Size(1, 1);
// Set our presentation parameters
presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;
CreateFlags createFalgs = CreateFlags.FpuPreserve | CreateFlags.DisableDriverManagement ;
if (Engine3DConfiguration.USE_HARDWARE_T_AND_L) {
	createFalgs |= CreateFlags.MixedVertexProcessing;
else {
        createFalgs |= CreateFlags.SoftwareVertexProcessing;
try {
        device = new Device(0, DeviceType.Hardware, this, createFalgs, presentParams);

My render loop is hooked to OnPaint event of WinForms control and that control is hosted by WindowsFormsHost in my WPF application. Could it be that WPF have something to do with that ??

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement