Author Topic: No texture when loading multiple 3DS  (Read 4847 times)

Offline Tishu

  • byte
  • *
  • Posts: 32
    • View Profile
No texture when loading multiple 3DS
« on: July 31, 2011, 08:41:17 pm »
Hello everyone

I am new to jPCT and find it very easy to learn and powerful! I am trying to import some models from Blender to jPCT-AE for an Android app. I have two .3DS files, and each file contains one textured object.
In my android project I have the two .3DS files and the two JPG textures.
When I load only one of the models (doesn't matter which one), it renders fine, textured. But when I try to load both, none of them appear textured.

I have seen this thread http://www.jpct.net/forum2/index.php?topic=2016.0 but the attached JAR did not solve the problem. I thought of a memory issue loading two textures, but they are not that big (20 and 160 KB) and I would have expected something in the logs in case this happens?

I am quite stuck, any help would be appreciated.

Thanks & Regards
Tishu

PS: Here is the logs in each case:

Loading only the first textured model:
Code: [Select]
07-31 19:31:47.964: INFO/jPCT-AE(1269): Loading file from InputStream
07-31 19:31:47.974: INFO/jPCT-AE(1269): Expanding buffers...16384 bytes
07-31 19:31:47.984: INFO/jPCT-AE(1269): Expanding buffers...24576 bytes
07-31 19:31:47.984: INFO/jPCT-AE(1269): Expanding buffers...32768 bytes
07-31 19:31:47.984: INFO/jPCT-AE(1269): File from InputStream loaded...28368 bytes
07-31 19:31:47.984: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.006
07-31 19:31:48.354: INFO/jPCT-AE(1269): Object 'Plane.006_jPCT-2' created using 1900 polygons and 1037 vertices.
07-31 19:31:48.354: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.005
07-31 19:31:48.354: INFO/jPCT-AE(1269): Object 'Plane.005_jPCT-1' created using 4 polygons and 8 vertices.
07-31 19:31:48.354: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.003
07-31 19:31:48.354: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.002
07-31 19:31:48.354: INFO/jPCT-AE(1269): Object 'Plane.002_jPCT0' created using 4 polygons and 8 vertices.
07-31 19:31:48.354: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane
07-31 19:31:48.354: INFO/jPCT-AE(1269): Object 'Plane_jPCT1' created using 4 polygons and 8 vertices.
07-31 19:31:49.164: INFO/jPCT-AE(1269): Loading file from InputStream
07-31 19:31:49.164: INFO/jPCT-AE(1269): File from InputStream loaded...293 bytes
07-31 19:31:49.164: INFO/jPCT-AE(1269): Processing new material pistexxxxxxx!
07-31 19:31:49.164: INFO/jPCT-AE(1269): Texture named piste.jpg added to TextureManager!
07-31 19:31:49.164: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane
07-31 19:31:49.174: INFO/jPCT-AE(1269): Object 'Plane_jPCT7' created using 2 polygons and 4 vertices.
07-31 19:31:49.174: INFO/jPCT-AE(1269): Loading Texture...
07-31 19:31:49.344: INFO/jPCT-AE(1269): Loading file from InputStream
07-31 19:31:49.344: INFO/jPCT-AE(1269): Expanding buffers...16384 bytes
07-31 19:31:49.344: INFO/jPCT-AE(1269): Expanding buffers...24576 bytes
07-31 19:31:49.344: INFO/jPCT-AE(1269): Expanding buffers...32768 bytes
07-31 19:31:49.344: INFO/jPCT-AE(1269): File from InputStream loaded...28368 bytes
07-31 19:31:49.344: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.006
07-31 19:31:49.604: INFO/jPCT-AE(1269): Object 'Plane.006_jPCT10' created using 1900 polygons and 1037 vertices.
07-31 19:31:49.604: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.005
07-31 19:31:49.604: INFO/jPCT-AE(1269): Object 'Plane.005_jPCT11' created using 4 polygons and 8 vertices.
07-31 19:31:49.604: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.003
07-31 19:31:49.604: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane.002
07-31 19:31:49.614: INFO/jPCT-AE(1269): Object 'Plane.002_jPCT12' created using 4 polygons and 8 vertices.
07-31 19:31:49.614: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane
07-31 19:31:49.614: INFO/jPCT-AE(1269): Object 'Plane_jPCT13' created using 4 polygons and 8 vertices.
07-31 19:31:50.554: INFO/jPCT-AE(1269): Loading file from InputStream
07-31 19:31:50.554: INFO/jPCT-AE(1269): File from InputStream loaded...293 bytes
07-31 19:31:50.554: INFO/jPCT-AE(1269): Processing new material pistexxxxxxx!
07-31 19:31:50.554: INFO/jPCT-AE(1269): Processing object from 3DS-file: Plane
07-31 19:31:50.554: INFO/jPCT-AE(1269): Object 'Plane_jPCT19' created using 2 polygons and 4 vertices.
07-31 19:31:50.554: INFO/jPCT-AE(1269): Loading Texture...
07-31 19:31:51.194: DEBUG/libEGL(1269): loaded /system/lib/egl/libGLES_android.so
07-31 19:31:51.194: DEBUG/libEGL(1269): loaded /system/lib/egl/libEGL_adreno200.so
07-31 19:31:51.234: DEBUG/libEGL(1269): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-31 19:31:51.244: DEBUG/libEGL(1269): loaded /system/lib/egl/libGLESv2_adreno200.so
07-31 19:31:51.404: INFO/jPCT-AE(1269): OpenGL vendor:     Qualcomm
07-31 19:31:51.404: INFO/jPCT-AE(1269): OpenGL renderer:   Adreno
07-31 19:31:51.404: INFO/jPCT-AE(1269): OpenGL version:    OpenGL ES-CM 1.1
07-31 19:31:51.404: INFO/jPCT-AE(1269): OpenGL renderer initialized (using 2 texture stages)
07-31 19:31:51.404: INFO/jPCT-AE(1269): Adding Lightsource: 0
07-31 19:31:51.414: INFO/jPCT-AE(1269): Memory usage before compacting: 3067 KB used out of 4935 KB
07-31 19:31:51.704: INFO/jPCT-AE(1269): Memory usage after compacting: 3063 KB used out of 4935 KB
07-31 19:31:51.894: INFO/jPCT-AE(1269): Subobject of object 18/object20 compiled to flat fixed point data using 5736 vertices in 91ms!
07-31 19:31:51.894: INFO/jPCT-AE(1269): Object 18/object20 compiled to 1 subobjects in 172ms!
07-31 19:31:51.894: INFO/jPCT-AE(1269): Subobject of object 21/object23 compiled to flat fixed point data using 6 vertices in 0ms!
07-31 19:31:51.894: INFO/jPCT-AE(1269): Object 21/object23 compiled to 1 subobjects in 2ms!

Loading only the second textured  model:
Code: [Select]
07-31 19:35:19.544: INFO/jPCT-AE(1585): Loading file from InputStream
07-31 19:35:19.544: INFO/jPCT-AE(1585): File from InputStream loaded...301 bytes
07-31 19:35:19.544: INFO/jPCT-AE(1585): Processing new material aroundpistex!
07-31 19:35:19.544: INFO/jPCT-AE(1585): Texture named apiste.jpg added to TextureManager!
07-31 19:35:19.544: INFO/jPCT-AE(1585): Texture named aroundpiste. added to TextureManager!
07-31 19:35:19.544: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.001
07-31 19:35:19.544: INFO/jPCT-AE(1585): Object 'Plane.001_jPCT7' created using 2 polygons and 4 vertices.
07-31 19:35:19.544: INFO/jPCT-AE(1585): Loading Texture...
07-31 19:35:19.704: INFO/jPCT-AE(1585): Loading file from InputStream
07-31 19:35:19.704: INFO/jPCT-AE(1585): Expanding buffers...16384 bytes
07-31 19:35:19.704: INFO/jPCT-AE(1585): Expanding buffers...24576 bytes
07-31 19:35:19.704: INFO/jPCT-AE(1585): Expanding buffers...32768 bytes
07-31 19:35:19.704: INFO/jPCT-AE(1585): File from InputStream loaded...28368 bytes
07-31 19:35:19.704: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.006
07-31 19:35:19.964: INFO/jPCT-AE(1585): Object 'Plane.006_jPCT8' created using 1900 polygons and 1037 vertices.
07-31 19:35:19.964: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.005
07-31 19:35:19.964: INFO/jPCT-AE(1585): Object 'Plane.005_jPCT9' created using 4 polygons and 8 vertices.
07-31 19:35:19.964: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.003
07-31 19:35:19.964: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.002
07-31 19:35:19.964: INFO/jPCT-AE(1585): Object 'Plane.002_jPCT10' created using 4 polygons and 8 vertices.
07-31 19:35:19.964: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane
07-31 19:35:19.964: INFO/jPCT-AE(1585): Object 'Plane_jPCT11' created using 4 polygons and 8 vertices.
07-31 19:35:20.794: INFO/jPCT-AE(1585): Loading file from InputStream
07-31 19:35:20.794: INFO/jPCT-AE(1585): File from InputStream loaded...301 bytes
07-31 19:35:20.794: INFO/jPCT-AE(1585): Processing new material aroundpistex!
07-31 19:35:20.794: INFO/jPCT-AE(1585): Processing object from 3DS-file: Plane.001
07-31 19:35:20.794: INFO/jPCT-AE(1585): Object 'Plane.001_jPCT17' created using 2 polygons and 4 vertices.
07-31 19:35:20.794: INFO/jPCT-AE(1585): Loading Texture...
07-31 19:35:21.014: DEBUG/libEGL(1585): loaded /system/lib/egl/libGLES_android.so
07-31 19:35:21.014: DEBUG/libEGL(1585): loaded /system/lib/egl/libEGL_adreno200.so
07-31 19:35:21.024: DEBUG/libEGL(1585): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-31 19:35:21.024: DEBUG/libEGL(1585): loaded /system/lib/egl/libGLESv2_adreno200.so
07-31 19:35:21.084: INFO/jPCT-AE(1585): OpenGL vendor:     Qualcomm
07-31 19:35:21.084: INFO/jPCT-AE(1585): OpenGL renderer:   Adreno
07-31 19:35:21.084: INFO/jPCT-AE(1585): OpenGL version:    OpenGL ES-CM 1.1
07-31 19:35:21.094: INFO/jPCT-AE(1585): OpenGL renderer initialized (using 2 texture stages)
07-31 19:35:21.094: INFO/jPCT-AE(1585): Adding Lightsource: 0
07-31 19:35:21.094: INFO/jPCT-AE(1585): Memory usage before compacting: 3830 KB used out of 6599 KB
07-31 19:35:21.344: INFO/jPCT-AE(1585): Memory usage after compacting: 3826 KB used out of 6599 KB
07-31 19:35:21.454: INFO/jPCT-AE(1585): Subobject of object 16/object18 compiled to flat fixed point data using 5736 vertices in 40ms!
07-31 19:35:21.464: INFO/jPCT-AE(1585): Object 16/object18 compiled to 1 subobjects in 105ms!
07-31 19:35:21.464: INFO/jPCT-AE(1585): Subobject of object 17/Plane.001_jPCT17 compiled to flat fixed point data using 6 vertices in 0ms!
07-31 19:35:21.464: INFO/jPCT-AE(1585): Object 17/Plane.001_jPCT17 compiled to 1 subobjects in 2ms!


Loading the two textured  models:
Code: [Select]
07-31 19:28:54.254: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:54.254: INFO/jPCT-AE(1138): Expanding buffers...16384 bytes
07-31 19:28:54.254: INFO/jPCT-AE(1138): Expanding buffers...24576 bytes
07-31 19:28:54.254: INFO/jPCT-AE(1138): Expanding buffers...32768 bytes
07-31 19:28:54.254: INFO/jPCT-AE(1138): File from InputStream loaded...28368 bytes
07-31 19:28:54.254: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.006
07-31 19:28:54.494: INFO/jPCT-AE(1138): Object 'Plane.006_jPCT-2' created using 1900 polygons and 1037 vertices.
07-31 19:28:54.494: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.005
07-31 19:28:54.494: INFO/jPCT-AE(1138): Object 'Plane.005_jPCT-1' created using 4 polygons and 8 vertices.
07-31 19:28:54.494: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.003
07-31 19:28:54.494: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.002
07-31 19:28:54.504: INFO/jPCT-AE(1138): Object 'Plane.002_jPCT0' created using 4 polygons and 8 vertices.
07-31 19:28:54.504: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane
07-31 19:28:54.504: INFO/jPCT-AE(1138): Object 'Plane_jPCT1' created using 4 polygons and 8 vertices.
07-31 19:28:55.294: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:55.304: INFO/jPCT-AE(1138): File from InputStream loaded...293 bytes
07-31 19:28:55.304: INFO/jPCT-AE(1138): Processing new material pistexxxxxxx!
07-31 19:28:55.304: INFO/jPCT-AE(1138): Texture named piste.jpg added to TextureManager!
07-31 19:28:55.304: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane
07-31 19:28:55.304: INFO/jPCT-AE(1138): Object 'Plane_jPCT7' created using 2 polygons and 4 vertices.
07-31 19:28:55.304: INFO/jPCT-AE(1138): Loading Texture...
07-31 19:28:55.394: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:55.394: INFO/jPCT-AE(1138): File from InputStream loaded...301 bytes
07-31 19:28:55.394: INFO/jPCT-AE(1138): Processing new material aroundpistex!
07-31 19:28:55.394: INFO/jPCT-AE(1138): Texture named apiste.jpg added to TextureManager!
07-31 19:28:55.394: INFO/jPCT-AE(1138): Texture named aroundpiste. added to TextureManager!
07-31 19:28:55.394: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.001
07-31 19:28:55.404: INFO/jPCT-AE(1138): Object 'Plane.001_jPCT10' created using 2 polygons and 4 vertices.
07-31 19:28:55.404: INFO/jPCT-AE(1138): Loading Texture...
07-31 19:28:55.554: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:55.554: INFO/jPCT-AE(1138): Expanding buffers...16384 bytes
07-31 19:28:55.554: INFO/jPCT-AE(1138): Expanding buffers...24576 bytes
07-31 19:28:55.554: INFO/jPCT-AE(1138): Expanding buffers...32768 bytes
07-31 19:28:55.554: INFO/jPCT-AE(1138): File from InputStream loaded...28368 bytes
07-31 19:28:55.554: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.006
07-31 19:28:55.814: INFO/jPCT-AE(1138): Object 'Plane.006_jPCT11' created using 1900 polygons and 1037 vertices.
07-31 19:28:55.824: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.005
07-31 19:28:55.824: INFO/jPCT-AE(1138): Object 'Plane.005_jPCT12' created using 4 polygons and 8 vertices.
07-31 19:28:55.824: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.003
07-31 19:28:55.824: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.002
07-31 19:28:55.824: INFO/jPCT-AE(1138): Object 'Plane.002_jPCT13' created using 4 polygons and 8 vertices.
07-31 19:28:55.824: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane
07-31 19:28:55.824: INFO/jPCT-AE(1138): Object 'Plane_jPCT14' created using 4 polygons and 8 vertices.
07-31 19:28:56.634: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:56.634: INFO/jPCT-AE(1138): File from InputStream loaded...293 bytes
07-31 19:28:56.634: INFO/jPCT-AE(1138): Processing new material pistexxxxxxx!
07-31 19:28:56.634: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane
07-31 19:28:56.634: INFO/jPCT-AE(1138): Object 'Plane_jPCT20' created using 2 polygons and 4 vertices.
07-31 19:28:56.634: INFO/jPCT-AE(1138): Loading Texture...
07-31 19:28:56.744: INFO/jPCT-AE(1138): Loading file from InputStream
07-31 19:28:56.744: INFO/jPCT-AE(1138): File from InputStream loaded...301 bytes
07-31 19:28:56.744: INFO/jPCT-AE(1138): Processing new material aroundpistex!
07-31 19:28:56.744: INFO/jPCT-AE(1138): Processing object from 3DS-file: Plane.001
07-31 19:28:56.744: INFO/jPCT-AE(1138): Object 'Plane.001_jPCT23' created using 2 polygons and 4 vertices.
07-31 19:28:56.744: INFO/jPCT-AE(1138): Loading Texture...
07-31 19:28:57.004: DEBUG/libEGL(1138): loaded /system/lib/egl/libGLES_android.so
07-31 19:28:57.004: DEBUG/libEGL(1138): loaded /system/lib/egl/libEGL_adreno200.so
07-31 19:28:57.014: DEBUG/libEGL(1138): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-31 19:28:57.014: DEBUG/libEGL(1138): loaded /system/lib/egl/libGLESv2_adreno200.so
07-31 19:28:57.084: INFO/jPCT-AE(1138): OpenGL vendor:     Qualcomm
07-31 19:28:57.084: INFO/jPCT-AE(1138): OpenGL renderer:   Adreno
07-31 19:28:57.084: INFO/jPCT-AE(1138): OpenGL version:    OpenGL ES-CM 1.1
07-31 19:28:57.084: INFO/jPCT-AE(1138): OpenGL renderer initialized (using 2 texture stages)
07-31 19:28:57.084: INFO/jPCT-AE(1138): Adding Lightsource: 0
07-31 19:28:57.084: INFO/jPCT-AE(1138): Memory usage before compacting: 4090 KB used out of 7367 KB
07-31 19:28:57.314: INFO/jPCT-AE(1138): Memory usage after compacting: 4085 KB used out of 7367 KB
07-31 19:28:57.424: INFO/jPCT-AE(1138): Subobject of object 19/object21 compiled to flat fixed point data using 5736 vertices in 56ms!
07-31 19:28:57.424: INFO/jPCT-AE(1138): Object 19/object21 compiled to 1 subobjects in 100ms!
07-31 19:28:57.434: INFO/jPCT-AE(1138): Subobject of object 22/object24 compiled to flat fixed point data using 6 vertices in 1ms!
07-31 19:28:57.434: INFO/jPCT-AE(1138): Object 22/object24 compiled to 1 subobjects in 3ms!
07-31 19:28:57.434: INFO/jPCT-AE(1138): Subobject of object 23/Plane.001_jPCT23 compiled to flat fixed point data using 6 vertices in 1ms!
07-31 19:28:57.434: INFO/jPCT-AE(1138): Object 23/Plane.001_jPCT23 compiled to 1 subobjects in 3ms!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: No texture when loading multiple 3DS
« Reply #1 on: July 31, 2011, 09:00:42 pm »
Looks like as if you are not adding the textures needed to the TextureManager in the last log output.

This part...

Code: [Select]
07-31 19:28:55.394: INFO/jPCT-AE(1138): Texture named apiste.jpg added to TextureManager!
07-31 19:28:55.394: INFO/jPCT-AE(1138): Texture named aroundpiste. added to TextureManager!

...indicates that the TextureManager has no idea what "apiste.jpg" and "aroundpiste." should be, but in the former logs, this doesn't seem to happen. Do you have some test case for this? I doubt that this in a bug in jPCT...it rather seems to be some problem with your loading code.

Offline Tishu

  • byte
  • *
  • Posts: 32
    • View Profile
Re: No texture when loading multiple 3DS
« Reply #2 on: July 31, 2011, 09:09:25 pm »
Thanks for your reply. It seems to me that this piece of logs do appear in the second extract, lines 4 and 5. I do add them to the manager in each case

Code: [Select]
final Object3D world = loadModel(is, 1);
final Texture texture = new Texture(Flight.getInstance().getResources().openRawResource(R.drawable.piste));
if(TextureManager.getInstance().containsTexture("piste.jpg"))
{
TextureManager.getInstance().removeTexture("piste.jpg");
}
TextureManager.getInstance().addTexture("piste.jpg", texture);
world.build();

And similarly for the second one.

I have checked that the textures are in the manager after everything is loaded

Code: [Select]
TextureManager.getInstance().getNames();

gives

Code: [Select]
07-31 19:47:38.435: DEBUG/(1975): [apiste.jpg, aroundpiste., --dummy--, piste.jpg]

I am trying to create an simple case where the issue is visible.

Thanks
Tishu

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: No texture when loading multiple 3DS
« Reply #3 on: July 31, 2011, 09:11:00 pm »
Yes, a test case would really help.

Offline Tishu

  • byte
  • *
  • Posts: 32
    • View Profile
Re: No texture when loading multiple 3DS
« Reply #4 on: July 31, 2011, 09:47:30 pm »
Right, while trying to set up a test case I think I understood what was wrong. I don't know if I am not using the API correctly of if there is an issue with it.

I have three objects in my world
- A plane
- A landing strip
- A control tower

On every frame, I draw the plane, then translate/rotate the landing strip and the control tower. On the first frame you cannot see either of these, but you can see the plane.
The camera is always looking at (0,0,0), where my plane is, and where my airport is at the beginning, when the models are loaded.
I setup the camera this way to always see the plane from behind:

Code: [Select]
final Camera cam = world.getCamera();
final SimpleVector pos = new SimpleVector();
pos.set(plane.getTransformedCenter());
pos.y = -2;
pos.z = 10;
cam.setPosition(pos);
cam.setFOV(60f);
cam.lookAt(plane.getTransformedCenter());

When I do it like this, after flying around with the plane, when the airport comes visible, it is not textured. When I place the camera on the original position of the airport however (which is the same as the model is at (0,0,0) when the stuff is initialised), it appears textured.

Code: [Select]
final Camera cam = world.getCamera();
final SimpleVector pos = new SimpleVector();
pos.set(strip.getTransformedCenter());
pos.y = -2;
pos.z = 10;
cam.setPosition(pos);
cam.setFOV(60f);
cam.lookAt(strip.getTransformedCenter());

I suppose this is something to do with lazy texturing - do not texture something that is not visible. In this case however, either I am not using the API correcly (should I reset the camera on every frame?) or there is an issue when those become visible.

I hope I was clear - this was a bit tricky to explain.

Thx
Tishu

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: No texture when loading multiple 3DS
« Reply #5 on: July 31, 2011, 09:51:23 pm »
There is no such thing as lazy texturing. The engine should upload the texture on first usage and that is, when the object using it comes into view for the first time. But i'm not aware of a situation where this fails...i'm waiting for the test case to check this out...

Offline Tishu

  • byte
  • *
  • Posts: 32
    • View Profile
Re: No texture when loading multiple 3DS
« Reply #6 on: July 31, 2011, 10:24:18 pm »
EgonOlsen,

I sent you a workspace in a private message. You should see the behaviour described above..

Thanks
Tishu

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: No texture when loading multiple 3DS
« Reply #7 on: July 31, 2011, 10:51:34 pm »
There are a few problems in your code (apart from the fact that i doesn't fully understand what happens where at first glance... ;)):

  • You seem to load the same texture multiple times and if you do, you remove the former instance from the TextureManager. Don't do this. The texture will be assigned to the loaded model at load time identified by the name it has in the file and the manager (see:http://www.jpct.net/wiki/index.php/Loading_models). If you remove it afterwards (even if you replace it with the same one with the same name), this assignment isn't valid anymore and the texture turns white. There's no need to remove the texture if it already is present in the manager. Just don't do anything to it in that case (or maybe better: Seperate texture loading from model loading).
  • Your loading order of textures and models seems to be wrong. Load the texture BEFORE the model or otherwise, the mentioned mechanism that assigns textures based on their names can't work and you'll get a white dummy texture instead.
  • ...and apart from these problems: Don't put textures into the drawable folder. Android is free to scale the images in that folder at load time and if it does, the texture isn't a power of 2 anymore and using it will fail. This happens seldom, but i've seen it on some devices.
« Last Edit: July 31, 2011, 11:09:07 pm by EgonOlsen »

Offline Tishu

  • byte
  • *
  • Posts: 32
    • View Profile
Re: No texture when loading multiple 3DS
« Reply #8 on: July 31, 2011, 11:45:41 pm »
Thanks for your advice, it seems to help. I can't explain why in the previous case it was working when the camera was set to view the airport and not when it was set on the plane.

I will let you know if I see other related issues.

Regards
Tishu