Fit Texture to Sphere

Started by kennydude, May 06, 2013, 08:10:44 PM

Previous topic - Next topic

kennydude

Hi, I'm trying to fix a texture to a sphere. However, it only shows part of the texture.

A texture in my app can look like this - http://i.imgur.com/dT7vDlY.jpg (the red parts will be changed in the future, just for reference)

However, I can only see the red area on my device using


public void setupWorld(){
mSphere = Primitives.getSphere(SPHERE_RADIUS);
mSphere.setCulling(false);
mSphere.setTexture("sphere");
mSphere.build();

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

mWorld.addObject(mSphere);

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

MemoryHelper.compact();
}


If someone could tell me what I'm doing wrong, that would be fantastic :)

Joe :)

p.s the whole code is Open Source @ https://github.com/kennydude/photosphere/tree/master/Android

EgonOlsen

Like the docs for the Primitives class state:

Quote
Except for the plane, objects created by this class don't have proper texture coordinates.

They are meant to be used as quick-and-dirty placeholders, not for real production use. You need some sphere model with proper coordinates and load that instead. Like this: http://www.jpct.de/download/net/misc/terra.asc