Hi everyone.
Help, what load mesh with several textures?
Here is my code, which loads the first texture on the whole mesh:
Global *mesh.ID3DXMesh=0
Global NMat.w=0
Global *Textures.IDirect3DTexture9
Global *ABuffer.ID3DXBuffer=0
Global *MBuffer.ID3DXBuffer=0
Procedure Load_Mesh(file.s)
If D3DXLoadMeshFromX(file.s,#D3DXMESH_MANAGED,*D3DDevice,@*ABuffer,@*MBuffer,0,@NMat,@*mesh)
ProcedureReturn #False
EndIf
*mtrl.D3DXMATERIAL=*MBuffer\GetBufferPointer()
D3DXCreateTextureFromFile(*D3DDevice,*mtrl\pTextureFilename,@*Textures)
EndProcedure
DirectX9 SDK
-
mpz
- Enthusiast

- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: DirectX9 SDK
Hi roman,
you must load the material of the texture too...
her comes a little pice of code for the textures:
best regards,
Michael
you must load the material of the texture too...
her comes a little pice of code for the textures:
Code: Select all
For n = 1 To NMat
;*material.D3DMATERIAL9 = *MBuffer\GetBufferPointer()+(n*72-72) ; with len (68)...
Texturadr = PeekL(*MBuffer\GetBufferPointer()+(n*72-4))
IpTextureFilename.s = PeekS(Texturadr)
D3DXCreateTextureFromFile(*D3DDevice, IpTextureFilename, @*Textures) ; You must add some more *Textures
next
Michael
Working on - MP3D Library - PB 5.73 version ready for download
