www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: jcoy on November 03, 2005, 02:21:20 am

Title: texture tiling?
Post by: jcoy on November 03, 2005, 02:21:20 am
How can I enable texture tiling when creating Object3Ds directly (meaning not using Loader)?

I'm trying to build some simple rectangles by making 6 planes with the following:

Code: [Select]

  public void addPlane(Object3D obj3D, SimpleVector v1, SimpleVector v2, SimpleVector v3, SimpleVector v4, int textureID);
    obj3D.addTriangle(v1, 0, 0, v4, 1, 0, v2, 0, 1, textureID);
    obj3D.addTriangle(v4, 1, 0, v3, 1, 1, v2, 0, 1, textureID);
  }


The problem I am having is it "streches" the texture to fill the plane.  Is there a way to make it tile the texture instead?  The problem is the rectangles will be different sizeses and we are trying to get a "uniformed"  look .  The texture is a simple 256x256 jpeg.
Title: texture tiling?
Post by: EgonOlsen on November 03, 2005, 08:31:14 am
You can use u/v-coordinates greater than 1 or below zero. For example 3 instead of 1 in your example should "triple" the texture onto the polygon.
Title: texture tiling?
Post by: Anonymous on November 03, 2005, 06:44:49 pm
Quote from: "EgonOlsen"
You can use u/v-coordinates greater than 1 or below zero. For example 3 instead of 1 in your example should "triple" the texture onto the polygon.


Perfect!  Thank you very much for the speedy reply and an excellent tool!