rifter1818
Junior Contributor
Yet another of my updated areas is giving me trouble,... my drawing of menus seems not to be working, all it is is drawing a 2d box (actually a 3d rectangle but all the z's are 0) the problem is that once i swiched it to textures it seems to have disapeared! help me please!
Visual Basic:
Public Function LoadTexture(ByVal sName As String) As Texture
LoadTexture = TextureLoader.FromFile(D3DDevice, sName, 64, 64, 1, 0, Format.A8R8G8B8, Pool.Managed, Filter.None, Filter.None, RGB(0, 0, 0))
End Function
Public Sub drawsquare(ByRef texture As Texture, ByVal x1 As Long, ByVal x2 As Long, ByVal y1 As Long, ByVal y2 As Long)
Dim vbuff As VertexBuffer
vbuff = New VertexBuffer(GetType(CustomVertex.PositionTextured), 6, D3DDevice, 0, CustomVertex.PositionTextured.Format, Pool.Default) 'create a new instance of the VertexBuffer object
Dim vertices As CustomVertex.PositionTextured() = DirectCast(vbuff.Lock(0, 0), CustomVertex.PositionTextured()) 'lock the vertex
vertices(0).X = x1
vertices(0).Y = y1
vertices(0).Tu = 0
vertices(0).Tv = 0
vertices(1).X = x2
vertices(1).Y = y1
vertices(1).Tu = 1
vertices(1).Tv = 0
vertices(2).X = x1
vertices(2).Y = y2
vertices(2).Tu = 0
vertices(2).Tv = 1
vertices(3).X = x2
vertices(3).Y = y2
vertices(3).Tu = 1
vertices(3).Tv = 1
vbuff.Unlock() 'unlock the vertex buffer
D3DDevice.RenderState.Lighting = False
D3DDevice.RenderState.CullMode = Cull.None
D3DDevice.SetTexture(0, texture)
D3DDevice.SetStreamSource(0, vbuff, 0) 'set the source for drawing the vertices
D3DDevice.VertexFormat = CustomVertex.PositionTextured.Format 'the format of the vertex
D3DDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2) 'draw the triangle
End Sub