Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!

   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

Posted

full and shade modes

 

did you remember to set your fill and shade modes?

 

D3DDevice.RenderState.FillMode = Solid

D3DDevice.RenderState.ShadeMode = Gouraud

Created by: X

createdbyx@gmail.com

www.createdbyx.com

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...