www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: judohin on February 17, 2012, 11:43:26 am

Title: Add Texture to Cylinder
Post by: judohin on February 17, 2012, 11:43:26 am
I am developing a android with a panorama function.
So I add a Cylinder to the app like this.

cube = Primitives.getCylinder(2.0f);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.invert();
cube.strip();
cube.build();

I use the calcTextureWrapSpherical() function, and the Texture duplicate like pic01 below.
And if i use calcTextureWrap() function, the texture become single color like pic02.
I have find a function recreateTextureCoords() in jPCT seem can fix this problem but it not exist in jPCT-AE.

Pic01
http://hkgetbonus.com/test/pic01.png (http://hkgetbonus.com/test/pic01.png)

Pic02
http://hkgetbonus.com/test/pic02.png (http://hkgetbonus.com/test/pic02.png)

Thank you!
 
Title: Re: Add Texture to Cylinder
Post by: EgonOlsen on February 17, 2012, 12:47:36 pm
The objects created by the Primitives class have no proper texture coordinates (except for the plane). They are meant for quick and dirty prototyping. The calcXXTextureWrap-methods are basically the same thing, i.e. they exist mainly to create at least some texture coordinates. If you want proper texturing, you have to do it in a modeller or load some model that somebody else created. The recreate...-method doesn't exist in jPCT-AE, because it's needed for the software renderer only. AE doesn't have this, so it doesn't need this method. It doesn't change/fix coordinates magically.