none
DirectX Texture Mapping in VB .Net RRS feed

  • Question

  • I'm currently learning Direct3D game programming in VB .Net but My tutorial skipped a crucial part of it... Texture mapping.

    Does anyone know how to Map textures to a custom vertex object? Here's what i have so far.


    Design cube
    Private Function CreateCube() As CustomVertex.PositionNormalTextured()
            Dim Box(15) As CustomVertex.PositionNormalTextured
            Dim zval As Single = 0.0F
            Dim inc As Integer = 3
            Box(0).Position = New Vector3(0, 0, zval)
            Box(1).Position = New Vector3(0, inc, zval)
            Box(2).Position = New Vector3(inc, inc, zval)
            Box(3).Position = New Vector3(inc, 0, zval)
            Box(4).Position = New Vector3(0, 0, zval)
    
            Box(5).Position = New Vector3(0, 0, zval - inc)
            Box(6).Position = New Vector3(0, inc, zval - inc)
            Box(7).Position = New Vector3(0, inc, zval)
            Box(8).Position = New Vector3(0, inc, zval - inc)
            Box(9).Position = New Vector3(inc, inc, zval - inc)
            Box(10).Position = New Vector3(inc, inc, zval)
            Box(11).Position = New Vector3(inc, inc, zval - inc)
            Box(12).Position = New Vector3(inc, 0, zval - inc)
            Box(12 + 1).Position = New Vector3(inc, 0, zval)
            Box(14).Position = New Vector3(inc, 0, zval - inc)
            Box(15).Position = New Vector3(0, 0, zval - inc)
    
    
    
            Return Box
    End Function

    In the Render Method, Draw the cube
            mydevice.DrawUserPrimitives(PrimitiveType.LineStrip, 15, CreateCube())


    My problem though, is all this does is make a cube wire frame. I need to figure out how to add textures to my 3D objects

    Does anyone know how this is done with the DirectX sdk in VB .Net?

    {We hack 'em You patch 'em}
    • Moved by Martin_XieModerator Friday, March 19, 2010 8:58 AM Redirect to appropriate forums for better support. (From:Visual Basic General)
    Saturday, March 13, 2010 4:04 PM