create a texture with a memoryStream

Started by
13 comments, last by cgillopez 15 years, 1 month ago
I tried with both but i have the same error. What can be wrong?

Dim ms As New MemoryStream()
Dim a As New Bitmap("C:\temp\DirectDraw\dx9vbu_mesh\Texture0.bmp")
a.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
Dim dat As Byte() = ms.ToArray()
texture = createTexture(ms)

Function createTexture(ByVal ms As MemoryStream) As Texture
Try
Dim asd As New Texture(device, ms, Usage.AutoGenerateMipMap, Pool.Default)

Catch ex As Exception
Console.Out.WriteLine(ex.Message) --> Application Error
End Try

This is driving me crazy....
Advertisement
Enable the debug runtimes in the D3D control panel, which is in the Start Menu entry for the DX SDK. Then turn on Unmanaged Debugging in VS, or use something like DebugView. It will produce more detailed output.
Hello again,

Im still having problems..

I turn on:
*Debugging: Maximum validation, Enable shader debugging, Break on memory leaks, break ib D3D9 error, Enable multi-mon debugging

*Debug output level: More

And if i enable Debug/Retail version of Direct3D 9 --> Use retail version of Direct3D 9; the application goes stright till
Dim asd As New Texture(device, ms, Usage.AutoGenerateMipMap, Pool.Default)

When it goes throw, it doesnt do anything, if i enable Use debug version of Direct3D 9; it gives an "error application".
I got it!

Function createTexture(ByVal ms As MemoryStream) As Texture
ms.Seek(0, SeekOrigin.Begin)
Return TextureLoader.FromStream(device, ms)
I got it!

Function createTexture(ByVal ms As MemoryStream) As Texture
ms.Seek(0, SeekOrigin.Begin)
Return TextureLoader.FromStream(device, ms)

This topic is closed to new replies.

Advertisement