Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Directx 9 and a problem

Im having a problem.
the image on the left below is the result, and the image on the right is what its drawing from. The one with the box is the one its suppost to draw, but you can see, its drawing from the bottom left row. Theres a missing pixle thats yellow on the edge.
i enlarged it because its easier to see whats going on:
[img=http://img59.imageshack.us/img59/6747/errorje1.png]

the image sprites.bmp is basicly 12 images of a char, 3 in each direction, each char is 32x64

here is the code:
[code]Sub MainLoop()
Dim dddevice As Device = Nothing
Dim DrawinTexture As Texture
Dim ColorKeyVal As Color
Dim Drawin As Sprite


Dim D3Dpp As PresentParameters = Nothing

Dim DP As DisplayMode = Nothing


DP = Manager.Adapters.Default.CurrentDisplayMode

D3Dpp = New PresentParameters

D3Dpp.BackBufferFormat = DP.Format
D3Dpp.BackBufferWidth = PictureBox1.Width
D3Dpp.BackBufferHeight = PictureBox1.Height

D3Dpp.SwapEffect = SwapEffect.Discard
D3Dpp.PresentationInterval = PresentInterval.Immediate

D3Dpp.Windowed = True


Drawin = New Sprite(dddevice)
dddevice = New Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, PictureBox1.Handle, CreateFlags.SoftwareVertexProcessing, D3Dpp)

Drawin = New Direct3D.Sprite(dddevice)
ColorKeyVal = Color.Black 'black
DrawinTexture = TextureLoader.FromFile(dddevice, Application.StartupPath & "DataGfxsprites.bmp", 0, 0, D3DX.Default, Usage.None, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, 0) ' ColorKeyVal.ToArgb)
dddevice.RenderState.Lighting = False

Me.Show()

Do While Not Quit


dddevice.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 255), 0, 0)
dddevice.BeginScene()

Drawin.Begin(SpriteFlags.None)
Drawin.Draw2D(DrawinTexture, New Rectangle(0, 128, 32, 64), New SizeF(32, 64), New Point(20, 20), Color.White)
Drawin.End()

dddevice.EndScene()
dddevice.Present()

Application.DoEvents()
Threading.Thread.Sleep(50)
Loop
On Error Resume Next
dddevice.Dispose()
dddevice = Nothing
Drawin.Dispose()
Drawin = Nothing
Application.Exit()
System.Environment.Exit(System.Environment.ExitCode)[/code]

thanks for advance for your help.
Sign In or Register to comment.