Author Topic: Add Texture to Cylinder  (Read 3145 times)

Offline judohin

  • byte
  • *
  • Posts: 1
    • View Profile
Add Texture to Cylinder
« 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

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

Thank you!
 

Online EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Add Texture to Cylinder
« Reply #1 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.