The problem is that my boxes i draw to generate a coordinate system are flickering all the time:
1. does anybody know how to solve this problem?
2. is it better practice to use terrainbox instead of boxes to draw the surface?
3. if i use terrainbox, how can i prevent that the texture scales over the hole terrainbox? i would prefer if the texture is repeated over the whole surface in its original size.
Texture t = TextureManager.loadTexture(monkeyLoc, Texture.MM_LINEAR, Texture.FM_LINEAR);
ts.setTexture(t);
for (int i = 1; i < 5; i++) {
for (int j = 1; j < 5; j++) {
Box box = new Box("box", new Vector3f(i*50, 0, j*50), 50f, 0.01f, 50f);
box.setRenderState(ts);
rootNode.attachChild(box);
}
}
Box y = new Box("y" ,new Vector3f(0,0,0), 0.1f, 100f, 0.1f);
Box x = new Box("x", new Vector3f(0,0,0), 100f, 0.1f, 0.1f);
Box z = new Box("z", new Vector3f(0,0,0), 0.1f, 0.1f, 100f);
Z-fighting is when you have more than one surface in the same location and in the same plane. You get a sketchy appearance like you have because during rendering parts of both get rendered on top each other due to numerical errors.
thx for you answers, but nevertheless i dont know exactly how to solve the problem. i have to draw all this boxes beaucse of the grid. as i have mentioned bevor, if i take the terrain block instead, the texture isn't correctly drawn.
if i insert this line the situation is better, but nevertheless solved. i think i should use it not for alle the node but only for some of them? right?
@pflanzenmoerder: if you like you can explain me your post in german ;) maybe i understand i better ;)
thx a lot! ah ok know i understand why this is happening. but with your code the problem isn't solved, because then the boxes aren't draw in the right position anymore.