Primitives and Texture Wrap

Started by tober6584, January 27, 2009, 02:01:46 AM

Previous topic - Next topic

tober6584

I'm just trying to recreate the rotating Earth from the demo on the home page, but when I create a sphere using Primitives and add my Earth texture it looks like the texture is actually applied twice, once to half the sphere, and once in mirror image to the other half, rather than wrapping around the whole sphere. Here's the code I'm using:

Quote
      earth = new Object3D(Primitives.getSphere(1000));
      earth.calcTextureWrapSpherical();
      earth.setTexture( "md2" + c + "004Earth.JPG" );
      earth.build();
      world.addObject( earth );

004Earth.JPG is a 256x256 pixel image of the Earth. I am able to correctly load md2 models and their textures, so maybe it has something to do with the calcTextureWrapSpherical call? Any help you could provide would be greatly appreciated.

JavaMan

Did you try just the caclTextureWrap? Maybe wrap spherical doesn't really work as expected on a Primitive's sphere. Or maybe Egon created a sphere and stored it in the jpct jar that is used in the demo and doesn't even call calcTextureWrapSpherical because his model has the texture coords set already.

tober6584

I did try calcTextureWrap and that gave me even worse results, just a dark green mesh. The demos that I downloaded don't have any spheres in them, and I didn't see anywhere to download the spinning planet demo.

EgonOlsen

The calcTextureWrap-methods are not meant to create great looking results. There are more or less for creating quick and dirty u/v-coordinates only. For creating a good looking planet, you need a textured sphere build in some modeler. I've uploaded the one that i was using for the planet-applet in ASC-format here: http://www.jpct.net/download/misc/terra.asc

tober6584

That seems to have done the trick. Thanks so much!

.jayderyu

Quote from: EgonOlsen on January 27, 2009, 09:36:19 AM
The calcTextureWrap-methods are not meant to create great looking results. There are more or less for creating quick and dirty u/v-coordinates only. For creating a good looking planet, you need a textured sphere build in some modeler. I've uploaded the one that i was using for the planet-applet in ASC-format here: http://www.jpct.net/download/misc/terra.asc

yeah unfortunealty I find it a bit annoying since most of my smaller game ideas use Primitive Objects :(, but hey just make to with what you got.