Main Menu
Menu

Show posts

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 Menu

Messages - mat1

#1
Support / Re: Unexpected Texture rendering.
October 05, 2013, 05:12:31 PM
Thanks for your help, in case any one else comes up against this problem, here is the code I am using:

planet1Texture = new Texture(assetManager.open("PlanetTexture1.png"));
TextureManager.getInstance().addTexture("Planet", planet1Texture);

.....

InputStream inputStrm1 = null;
try {
       inputStrm1 = assetManager.open("Planet.3ds");
   }catch

.....

planet1 = loadModel(inputStrm1, 5.0f);
planet1.setTexture("Planet");
planet1.build();
planet1.strip();
world.addObject(planet1);

.....

public Object3D loadModel(InputStream filename, float scale) {
        Object3D[] model = Loader.load3DS(filename, scale);
        Object3D o3d = new Object3D(0);
        Object3D temp = null;
        for (int i = 0; i < model.length; i++) {
            temp = model;
            temp.setCenter(SimpleVector.ORIGIN);
            temp.rotateX((float)( -.5*Math.PI));
            temp.rotateMesh();
            temp.setRotationMatrix(new Matrix());
            o3d = Object3D.mergeObjects(o3d, temp);
            o3d.build();
        }
        return o3d;
    }

The result is attached.

[attachment deleted by admin]
#2
Support / Unexpected Texture rendering.
October 05, 2013, 01:12:16 PM
Hello,

   I am trying to add a texture to a sphere (PlanetTexture1.png attached) but I find that it is  rendered a plain green as in the screenshot (Screenshot.png also attached). Here is the code I am using:

Texture Manager:
    planet1Texture = new Texture(assetManager.open("PlanetTexture1.png"));
    TextureManager.getInstance().addTexture("PlanetTexture1.png", planet1Texture);

The model object:   
     planet1 = Primitives.getSphere(5.0f);
    SimpleVector planetPos = new SimpleVector();
    planetPos.set(25, 0, 30);
    planet1.setOrigin(planetPos);
    planet1.setTexture(ti1);
    planet1.build();
    planet1.strip();
    world.addObject(planet1);
 
Add texture to model:
TextureInfo ti1 = new TextureInfo(TextureManager.getInstance().getTextureID("PlanetTexture1.png"));

What do I need to add to get that texture rendered as I would see it in the png file?

[attachment deleted by admin]