DirectX9 SDK

Advanced game related topics
Roman
New User
New User
Posts: 5
Joined: Sun Sep 19, 2010 12:34 pm

DirectX9 SDK

Post by Roman »

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
mpz
Enthusiast
Enthusiast
Posts: 497
Joined: Sat Oct 11, 2008 9:07 pm
Location: Germany, Berlin > member German forum

Re: DirectX9 SDK

Post by mpz »

Hi roman,

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
best regards,
Michael
Working on - MP3D Library - PB 5.73 version ready for download
Post Reply