   [.net] Loading textures
  I don't understand why I get errors on this line...Texture characters = new Texture(graphics.Device, Bitmap.FromFile("graphics/wee.bmp"), Usage.DepthStencil, Pool.Default);Error1The best overloaded method match for 'Microsoft.DirectX.Direct3D.Texture.Texture(Microsoft.DirectX.Direct3D.Device, System.Drawing.Bitmap, Microsoft.DirectX.Direct3D.Usage, Microsoft.DirectX.Direct3D.Pool)' has some invalid argumentsC:\Documents and Settings\ryan\Desktop\RCade\frmGame.cs2134RCadeError2Argument '2': cannot convert from 'System.Drawing.Image' to 'System.Drawing.Bitmap'C:\Documents and Settings\ryan\Desktop\RCade\frmGame.cs2163RCade   
  hmm...maby its becuase my device isn't being created :D. I have a picturebox, which I pass the handle to my class which initalizes Direct3D.EXCEPTION:Microsoft.DirectX.Direct3D.InvalidCallException was caught  Message="Error in the application."  Source="Microsoft.DirectX"  AdditionalInformation=""  ErrorCode=-2005530516  ErrorString="D3DERR_INVALIDCALL"  StackTrace:  at Microsoft.DirectX.Direct3D.Device..ctor(Int32 adapter, DeviceType deviceType, IntPtr renderWindowHandle, CreateFlags behaviorFlags, PresentParameters[] presentationParameters)  at RCade.cRenderer.initDevice() in C:\Documents and Settings\ryan\Desktop\RCade\cRenderer.cs:line 56my params   /// <summary>   /// Builds the PresentParameters   /// </summary>   /// <returns>True if the parameters were successfully created</returns>   private bool buildPresentParams()   {  _presentParams = new PresentParameters();  Format adaptorFormat = ( _windowed ) ? _displayMode.Format : Format.X8R8G8B8;  if(Manager.CheckDeviceFormat(0, DeviceType.Hardware, adaptorFormat, Usage.DepthStencil, ResourceType.Surface, DepthFormat.D24S8))  { _presentParams.AutoDepthStencilFormat = DepthFormat.D24S8;  }  else if(Manager.CheckDeviceFormat(0, DeviceType.Hardware , adaptorFormat, Usage.DepthStencil, ResourceType.Surface, DepthFormat.D24S8))  { _presentParams.AutoDepthStencilFormat = DepthFormat.D24S8;  }  else if(Manager.CheckDeviceFormat(0, DeviceType.Hardware, adaptorFormat, Usage.DepthStencil, ResourceType.Surface, DepthFormat.D16))  { _presentParams.AutoDepthStencilFormat = DepthFormat.D16;  }  else  { return false;  }  _presentParams.BackBufferWidth = ( _windowed ) ? 0 : _displayMode.Width;  _presentParams.BackBufferHeight = ( _windowed ) ? 0 : _displayMode.Height;  _presentParams.BackBufferCount = 1;  _presentParams.MultiSampleType = MultiSampleType.None;  _presentParams.MultiSampleQuality = 0;  _presentParams.SwapEffect = SwapEffect.Discard;  _presentParams.DeviceWindowHandle = _windowHandle;  _presentParams.IsWindowed = _windowed;  _presentParams.EnableAutoDepthStencil = false;  _presentParams.PresentFlag = PresentFlag.DiscardDepthStencil;  _presentParams.FullScreenRefreshRateInHz = ( _windowed ) ? 0 : _displayMode.RefreshRate;  _presentParams.PresentationInterval = PresentInterval.Immediate;  return true;   };  Try using TextureLoader if it's from a file. Won't solve the error probably, but it will sure speed up things.   ;  Try using TextureLoader if it's from a file. Won't solve the error probably, but it will sure speed things up.   ;  in your project properties, enable unmanaged debugging.Also, go into the control panel and into the directX page, then set direct3d to the debug runtime and full debugging.Now, when the error occurs you should get a detailed explaination in the output window.   ;  Ugh, read the messages. System.Drawing.Bitmap.FromFile does not return a Bitmap. Thus you're trying to pass Not a Bitmap to something that expects a Bitmap and it fails.As Alex says, TextureLoader.FromFile is a bit nicer to deal with.   