8
« on: October 10, 2011, 09:41:39 pm »
Ok, I tried to get it working, but somehow I canīt figure it out.
private final static float textureMaxX = 100f;
private final static float textureMaxY = 130f;
//in some init function. this draws a rectangle which is later been filled by a texture
Object3D background = new Object3D(2);
SimpleVector vert1 = new SimpleVector(0, 0, 0);
SimpleVector vert2 = new SimpleVector(textureMaxX, 0, 0);
SimpleVector vert3 = new SimpleVector(textureMaxX, textureMaxY, 0);
SimpleVector vert4 = new SimpleVector(0, textureMaxY, 0);
background.addTriangle(vert3, 1, 1, vert2, 1, 0, vert1, 0, 0);
background.addTriangle(vert3, 1, 1, vert1, 0, 0, vert4, 0, 1);
world.addObject(background);
//in onDrawFrame
background.translate(100, 0, 0);
background.translateMesh();
background.scale(1.01f);
background.translate(-100, 0, 0);
background.translateMesh();
Now whatever values I translate and back-translate the background, it always scales around the center in this example. My first example, which scaled around top left was a 'rootNode', which was instantiated by Object3D.createDummyObj() and is used to group objects. From the above code, I expected to receive a scaling around the right edge of my background rectangle. Am I doing something wrong?
Cheers and thanks for all your efforts!
Marc