Thanks EgonOlsen for your fast response, it works!
The solution can be so easy if you know how to do it :-)
Grüße aus Köln :-)
The solution can be so easy if you know how to do it :-)
Grüße aus Köln :-)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote
newmtl material_0
map_Kd oetzi_TEXTURE-0.jpg
newmtl material_1
map_Kd oetzi_TEXTURE-1.jpg
newmtl material_2
map_Kd oetzi_TEXTURE-2.jpg
inputStreamMTL = masterContext.getAssets().open("3d-objects/oetzi-obj/oetzi_MATERIAL.mat");
inputStream = masterContext.getAssets().open("3d-objects/RackForFlowers/Rack for flowers N020813.3DS");
TextureManager.getInstance().addTexture("RackForFlowers0", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/Archmodels66_dirt_1.jpg")));
TextureManager.getInstance().addTexture("RackForFlowers1", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/Archmodels66_leaf_30.jpg")));
TextureManager.getInstance().addTexture("RackForFlowers2", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/PaperDecorative0011_1_L.jpg")));
TextureManager.getInstance().addTexture("RackForFlowers3", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/PaperDecorative0011_1_L.jpg")));
Object3D newObject;
Object3D[] objs = Loader.load3DS(inputStream, 1f);
Log.i("MyRenderer", "## objs.length ## " + objs.length);
newObject = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < objs.length; i++) {
temp = objs[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float)( -.5*Math.PI));
temp.rotateMesh();
String tmpName = "RackForFlowers" + Integer.toString(i);
Log.i("MyRenderer", "## tmpName ## " + tmpName);
temp.setTexture(tmpName);
temp.setRotationMatrix(new Matrix());
newObject = Object3D.mergeObjects(newObject, temp);
newObject.build();
}
Quote
08-19 10:26:48.985: I/MyRenderer(28308): ## objs.length ## 4
08-19 10:26:48.985: I/MyRenderer(28308): ## tmpName ## RackForFlowers0
08-19 10:26:49.015: E/AndroidRuntime(28308): FATAL EXCEPTION: GLThread 28178
08-19 10:26:49.015: E/AndroidRuntime(28308): java.lang.RuntimeException: [ 1376900808997 ] - ERROR: Tried to set an undefined texture!
08-19 10:26:49.015: E/AndroidRuntime(28308): at com.threed.jpct.Logger.log(Logger.java:189)
08-19 10:26:49.015: E/AndroidRuntime(28308): at com.threed.jpct.Object3D.setTexture(Object3D.java:3434)
08-19 10:26:49.015: E/AndroidRuntime(28308): at de.oetzi.dreid_test.MyRenderer.loadMeshFile(MyRenderer.java:146)
08-19 10:26:49.015: E/AndroidRuntime(28308): at de.oetzi.dreid_test.MyRenderer.onSurfaceChanged(MyRenderer.java:84)
08-19 10:26:49.015: E/AndroidRuntime(28308): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
08-19 10:26:49.015: E/AndroidRuntime(28308): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
inputStream = masterContext.getAssets().open("3d-objects/RackForFlowers/Rack for flowers N020813.3DS");
TextureManager.getInstance().addTexture("dirt", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/Archmodels66_dirt_1.jpg")));
TextureManager.getInstance().addTexture("leaf", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/Archmodels66_leaf_30.jpg")));
TextureManager.getInstance().addTexture("paper", new Texture(masterContext.getAssets().open("3d-objects/RackForFlowers/textures/PaperDecorative0011_1_L.jpg")));
Object3D newObject;
Object3D[] objs = Loader.load3DS(inputStream, 1f);
Log.i("MyRenderer", "## objs.length ## " + objs.length);
newObject = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < objs.length; i++) {
temp = objs[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float)( -.5*Math.PI));
temp.rotateMesh();
temp.setTexture("Ball"); ##### <-- this worked for the ball object, which consists only of 1 part
temp.setRotationMatrix(new Matrix());
newObject = Object3D.mergeObjects(newObject, temp);
newObject.build();
}
return newObject;
TextureManager.getInstance().addTexture("main_product_133750009413897300.jpg", texture);
inputStream = masterContext.getAssets().open("3d-objects/ball/Ball N280313.3DS");
Texture texture = new Texture(masterContext.getAssets().open("3d-objects/ball/main_product_133750009413897300.jpg"));
TextureManager.getInstance().addTexture("main_product_133750009413897300.jpg", texture);
Page created in 0.114 seconds with 12 queries.