C#: Unable to create DirectX device. Neither Hardware type or Software type works -
i'm trying create directx device through following code:
caps devicecapability; int deviceadapter = manager.adapters.default.adapter; try { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.hardware); } catch (exception ex1) { try { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.software); } catch (exception ex2) { devicecapability = manager.getdevicecaps( deviceadapter, devicetype.reference); } } createflags deviceflags = createflags.softwarevertexprocessing; if(devicecapability.devicecaps.supportshardwaretransformandlight == true) { deviceflags = createflags.hardwarevertexprocessing; } mdevice = new device(deviceadapter, devicecapability.devicetype, minvisiblepanel, deviceflags, mpresentparams);
the problem works on computers (such work computer), while doesn't on others (to specific, panasonic cf-19 toughbook). i've checked make sure offending pc has hardware acceleration enabled via dxdiag, , still doesn't budge.
unfortunately, error message is, "error on application." i've stuck several message boxes between above code, , never seems hit ex1 , ex2 catch block.
any ideas on how fix this?
edit: sorry, realized forgot show presentparameters.
// setup device parameters presentparameters mpresentparams = new presentparameters(); mpresentparams.windowed = true; mpresentparams.swapeffect = swapeffect.discard; mpresentparams.autodepthstencilformat = depthformat.d16; mpresentparams.enableautodepthstencil = true; ///* todo: anti-aliasing not working mpresentparams.multisample = multisampletype.nonmaskable; mpresentparams.multisamplequality = 0;
solved it. darn, feel stupid already.
reducing presentparameters these 3 lines made work on toughbook.
// setup device parameters presentparameters mpresentparams = new presentparameters(); mpresentparams.windowed = true; mpresentparams.swapeffect = swapeffect.discard;
Comments
Post a Comment