Using .X files with

I have created a number of objects in VB using my own images as textures, I'm trying to use .x files now I have a 3D app that can export to these files.

How do I load the .x files in and use the textures from the .x file that I have created?

code so far - gets me the objects but they are WHITE all the time, is it my code or my 3D app?

Public Sub LoadMesh(ByVal file_path As String, ByVal file_name As String)
Dim Subset As Integer
Dim TextureFileName As String

objMesh = Mesh.FromFile(FileName, MeshFlags.SystemMemory, d3ddev, extMaterials)

ReDim MeshTexture(extMaterials.Length - 1) 'was not -1

ReDim Mat(extMaterials.Length - 1)

For Subset = 0 To extMaterials.Length - 1

TextureFileName = extMaterials(Subset).TextureFilename
If TextureFileName IsNot Nothing Then
Debug.WriteLine("Texture " & Subset & ": " & TextureFileName)
If TextureFileName.Length > 0 Then
MeshTexture(Subset) = TextureLoader.FromFile(d3ddev, TextureFileName)
Catch ex As Exception
Debug.WriteLine("Error loading texture " & TextureFileName)
End Try
End If
Debug.WriteLine("Texture " & Subset & ": " & "")
End If

Mat(Subset) = extMaterials(Subset).Material3D

Mat(Subset).Ambient = Mat(Subset).Diffuse


Sign In or Register to comment.

Howdy, Stranger!

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