Author Topic: multiple textures  (Read 2167 times)

Offline mich19

  • Mc. Print
  • *
  • Posts: 15
    • View Profile
multiple textures
« on: 2006-Mar-23 »
how to have several textures with only one file.ddd

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
multiple textures
« Reply #1 on: 2006-Mar-23 »
You can't you have to split the .ddd in 2 objects and assign the textures before rendering using X_SETTEXTURE. You can write a function that renders them in one call like:

Code: GLBasic [Select]
// Ini - file:
[obj]
count=2
ob1 = obj1.ddd
tx1 = texture1.bmp
ob2 = obj2.ddd
tx2 = texture2.bmp
/// end ini file

GLOBAL obj[]
LoadMultiObject("kungfu.ini", 1, obj[])
X_MOVEMENT 100,0,100
Render(obj[])
SHOWSCREEN
MOUSEWAIT
END


FUNCTION LoadMutiObject: ini_name$, id, obj[]
INIOPEN ini_name$
num = INIGET("obj", "count")
DIM obj[num]
FOR i=1 TO num
   X_LOADOBJ INIGET("obj", "ob"+i), i+100*id
  LOADSPRITE INIGET("obj", "tx"+i), i+100*id
  obj[i-1] = i+100*id
NEXT
ENDFUNCTION

FUNCTION Render: obj[]
FOR i=0 TO BOUNDS(obj[],0)-1
   X_SETTEXTURE obj[i], -1
   X_DRAWOBJ obj[i], 0
NEXT
ENDFUNCTION