sphere texture inside

Started by trn173, November 18, 2013, 03:51:25 AM

Previous topic - Next topic

trn173

Hi everybody!

This is my first jpct project.I wanna develop panorama project.I use sphere object3d.I didnt understand "how i use camere inside my object3d(sphere)?" and "how i reverse sphere texture for panoramic picture?".

this is my code

Texture texture1 = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.stest)), 1024,512));
TextureManager.getInstance().addTexture("texture", texture1);

cube = Primitives.getSphere(100);
//cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.setCulling(false);
cube.build();

world = new World();
world.setAmbientLight(200,200,200);

world.addObject(cube);

Camera camera = world.getCamera();
camera.moveCamera( Camera.CAMERA_MOVEOUT, 30 );
//camera.setPosition( mSphere.getTransformedCenter() );
camera.lookAt( cube.getTransformedCenter());
//camera.moveCamera(Camera.CAMERA_MOVEIN, 5);


if i didnt use "calcTextureWrapSpherical", sphere not show,


kind rigards

EgonOlsen

Like the docs for the Primitives-class say: "Except for the plane, objects created by this class don't have proper texture coordinates."...which is why you don't see much in your case if you don't create them somehow. The sphere is actually there even without it, it's just single colored because all the
u/v-coordinates are 0/0. If you want proper uv-coordinates to map a spherical texture, a "real" model is more suitable. Maybe this is a good starting point: http://www.jpct.net/download/misc/terra.asc

BTW: To look at the sphere from the inside, it's better to do this instead:


cube.setTexture("texture");
cube.invert();
cube.build();


because otherwise, the normals will still point int the wrong direction and once you start adding light sources, the inside will remain dark.