Bitmap to surface...

  • Thread starter Thread starter Jameson
  • Start date Start date
J

Jameson

ok...

This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using .Net 3.5 runtime and
the latest DirectX Dev Kit form March) to turn a bitmap into a
surface?

Public Function img2surface(ByVal img As Bitmap) As Direct3D.Surface
Dim image As Direct3D.Surface
image = New Direct3D.Surface(device, img,
Direct3D.Pool.Default)
Return image
End Function
 
I'm referencing DirectX in VB2008 DOTNET, not using XNA. The Bitmap is the
appropriate size. I'm stumped as to what is going on. If I don't try to
draw anything, I get my nice blue screen. So I am assuimg everything up to
that point is ok.
 
If I use XNA don't my customers then have to download and install XNA,
directx is basicly on every machine and since I am only going to be using
really basic operations (NO 3D what so ever) is XNA still the best choice?
 
Jameson said:
The Bitmap is
the appropriate size. I'm stumped as to what is going on. If I don't
try to draw anything, I get my nice blue screen. So I am assuimg
everything up to that point is ok.

What's the pixel format of the bitmap? I guess that the method won't
convert the pixel format, so it should probably be 24 bit or 32 bit.
 
Back
Top