Author Topic: sphere texture inside  (Read 857 times)

Offline trn173

  • byte
  • *
  • Posts: 1
    • View Profile
sphere texture inside
« on: November 18, 2013, 03:51:25 am »
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);

world = new World();


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
« Last Edit: November 18, 2013, 03:53:13 am by trn173 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11884
    • View Profile
Re: sphere texture inside
« Reply #1 on: November 18, 2013, 07:55:18 am »
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:

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

Code: [Select]

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