Author Topic: dynamic texture loading  (Read 1851 times)

Offline nileshlg

  • byte
  • *
  • Posts: 9
    • View Profile
dynamic texture loading
« on: February 04, 2015, 12:37:13 pm »
Hi,
In my Vuforia + Jpct-AE app I have to download the 3d model (.obj, .mtl, .jpg) from remote server upon Image detection and render / replace with current 3D object  and respective texture in jpct scene. Until this point it works fine; However my problem is some times some 3D models will have multiple textures (jpegs). How can I add those textures in the texture manager and apply to object dynamically.
For example, Initially I have box model in scene, upon first scan I download and replace Box with table (2 textures) but in next scan I might use Room.obj which contain 4-5 textures. Now I don't know How many texture images are there in folder until I scan the folder and check for no. of jpegs programmatically.  but then how can I replace 4-5 textures with previous 2 textures.
Honestly, I am little confused about texture manager and handling it. I would really appreciate if some one help me with logic or source code wise.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: dynamic texture loading
« Reply #1 on: February 04, 2015, 07:03:41 pm »
I'm not sure if i get the problem...you have a collection of objects and a set of textures for each? And you want to know how to deal with them? That's actually really simple. If your object collection is limited in number and all the textures of all objects would fit into teh device's memory, you can just load and add the textures to the TextureManager when you load the model and you are done. If you want to remove unused textures fropm old models from the Manager again, just use this method: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/TextureManager.html#removeAndUnload(java.lang.String, com.threed.jpct.FrameBuffer)

That's actually all there is to it. You don't have to replace anything in the manager unless you want to update the texture without updating the model.