Bitmap to surface...

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
 
J

Jameson

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.
 
J

Jameson

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?
 
G

Göran Andersson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top