hello
Got a strange thing. and i don t know if it is a bug of the TextureManager or not
I have an app with 2 different world objects (rendered using the same loop in two different canvas using AWTGLRenderer). One is supposed to show the selected object while the other one is displaying the whole map.
I don t know why but i am unable to have the same texture (registered in the TextureManager displayed in both world).
When texture are different there is no problem at all... I have spent hours checking my code and it seems to be correct, the good texture indice is called in order to paint a polygon...
In fact the first world where a texture will be called to be displayed will not be a problem. The problem will occur in the second one (i tested the order and the problem can be inversed)
So 3 questions.
Did anyone already do something similar that worked?
Do you have any idea what may cause this problem?
Here is a screenshot
here is the code i use to register texture in the texture manager
protected void addTexture(String textureName, String textureFile){
if (!TextureManager.getInstance().containsTexture(textureName)){
Texture tmpTexture = new Texture(Constants.TEXTURE_PATH+textureFile);
TextureManager.getInstance().addTexture(textureName, tmpTexture);
}
}
protected void addTexture(String textureFile){
addTexture(textureFile,textureFile);
}
Here is my general loop:
public void startLoop(){
while (true){
[...]
myPanel3D.updateLoop(); // panel with the first JPCT world
menuTabbedPanel.getMyPreviewPanel().updateLoop(); // panel with the second JPCT world
// both these panels have a JPCTPanel super class that implements the updateLoop method
[...]
try{
Thread.sleep(10);
}
catch (InterruptedException ie){
System.err.println("startLoop");
ie.printStackTrace();
}
Thread.yield();
}
}
and here is the update loop method
public void updateLoop(){
buffer.clear();
updateCamera();
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.update();
synchronized(evt3DList){
this.processEvt3DList();
}
synchronized(draggedCoordinateList){
this.processDraggedCoordinate();
}
buffer.display(null);
myCanvas.repaint();
}
So any idea?
thanks