Original Post
I'm working on a tutorial that is about creating graphical devices. In the code there is some if statements to check if the computer supports hardware or software vertex processing, but when creating the device one of the parameters is DeviceType.Hardware. Wouldn't this make the if statements useless if it's passing that parameter?
public Game()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.Opaque, true);
int adapterOrdinal = Manager.Adapters.Default.Adapter;
Caps caps = Manager.GetDeviceCaps(adapterOrdinal, DeviceType.Hardware);
CreateFlags createFlags;
if (caps.DeviceCaps.SupportsHardwareTransformAndLight)
{
createFlags = CreateFlags.HardwareVertexProcessing;
}
else
{
createFlags = CreateFlags.SoftwareVertexProcessing;
}
if (caps.DeviceCaps.SupportsPureDevice && createFlags == CreateFlags.HardwareVertexProcessing)
{
createFlags |= CreateFlags.PureDevice;
}
PresentParameters presentParams = new PresentParameters();
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.Windowed = true;
#if DEBUG
presentParams.Windowed = true;
#endif
device = new Device(
adapterOrdinal,
DeviceType.Hardware,
this,
createFlags,
presentParams);
}