Weird Displayproblem with Textures

Hi,

My game is almost running, but i when i tried it under Windows XP i got some weird display errors.



So first of all, here is a screenshot what it should look like:





But when i run it under Windows XP (and a friend of mine tried it with his Macbook he got the same errors, but on my macbook everythink is fine) it looks like this:







So, only the textures close to the player are displayed right, the others look kinda weird^^

I don’t even now, where really to look for the error.

So here is the method, how i create the Walls and the Ground:

public static Box createWall(String name,Vector3f pos1,Vector3f pos2,TextureState texState,StandardGame game) {
      // Front Wall
      Box wall = new Box(name,pos1,pos2);
      wall.setModelBound(new BoundingBox());
      wall.updateModelBound();

      CullState culling = game.getDisplay().getRenderer().createCullState();
      culling.setCullFace(CullState.Face.Back);
      wall.setRenderState(culling);
      
      wall.setRenderState(texState);

      return wall;      
   }



And that's how i get the texturestate:

wallTexture = game.getDisplay().getRenderer().createTextureState();
      URL groundLoc;
      groundLoc = Main.class.getClassLoader().getResource("wallTextur.jpg");
      Texture texture = TextureManager.loadTexture(groundLoc, Texture.MinificationFilter.BilinearNearestMipMap , Texture.MagnificationFilter.Bilinear);
      
      texture.setScale(new Vector3f(1.0f,1.0f,1.0f));
      
      wallTexture.setTexture(texture);
      wallTexture.setEnabled(true);



Do you have any idea whats going wrong?

First step, try some of the examples on the problem machines, this rules out hardware drivers requiring updates.

Hi,

I gonna try some other examples later, can't use the computer right now. :frowning:



But i made a small example, which doesn't work on the pc, but works fine on my macbook.

Maybe you can try it:


import java.io.InputStream;
import java.net.URL;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;

import com.jme.bounding.BoundingBox;
import com.jme.image.Texture;
import com.jme.light.PointLight;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.scene.state.CullState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.util.GameTaskQueueManager;
import com.jme.util.TextureManager;
import com.jmex.editors.swing.settings.GameSettingsPanel;
import com.jmex.game.StandardGame;
import com.jmex.game.state.DebugGameState;
import com.jmex.game.state.GameStateManager;
 
/**
 * Started Date: Aug 16, 2004<br><br>
 *
 * This program teaches Continuous Level of Detail mesh objects. To use this program, move
 * the camera backwards and watch the model disappear.
 *
 * @author Jack Lindamood
 */
public class Test {
   Node rootNode;
   StandardGame game;
   static Node walls = new Node("walls");
   static Document document;
   
   public TextureState wallTexture,groundState,wallTexUp,wallTexDown,wallHandprints;
   
   public static void main(String[] args) {
      StandardGame game = new StandardGame("Scrubs3D");
      System.setProperty("jme.stats", "set");
      try{
         if(!GameSettingsPanel.prompt(game.getSettings())) {
            // User pressed Cancel-Button
            return ;
         }
      }catch(Exception e){
         e.printStackTrace();
      }
      
      game.start();
      
      Future<Object> test = GameTaskQueueManager.getManager().update(new Callable<Object>() {
         public Object call() throws Exception {
            DebugGameState gameState = new DebugGameState();
            GameStateManager.getInstance().attachChild(gameState);
            gameState.setActive(true);
            return null;
         }
        });
      
      try {
         test.get();
      } catch (InterruptedException e) {
         
      } catch (Exception e) {
         
      }
      

      DebugGameState gameState = (DebugGameState)GameStateManager.getInstance().getChild(0);
      gameState.getLightState().setEnabled(false);
      
      new Test(gameState.getRootNode(),game);
   }
   
   public Test(Node rootNode,StandardGame game) {
      this.rootNode = rootNode;
      this.game = game;
      

      walls = new Node("Walls");
      

      rootNode.attachChild(walls);

      LightState lightState = game.getDisplay().getRenderer().createLightState();
      
      PointLight pointLight = new PointLight();
      pointLight.setLocation(new Vector3f(0,0,0));
      pointLight.setDiffuse(ColorRGBA.white);
      pointLight.setEnabled(true);
      
      
      //lightState.detachAll();
      lightState.attach(pointLight);
      
      rootNode.setRenderState(lightState);
      rootNode.updateRenderState();
      
      //Load Objects
      
      wallTexture = game.getDisplay().getRenderer().createTextureState();
      URL groundLoc;
      groundLoc = Main.class.getClassLoader().getResource("wallTextur.jpg");
      Texture texture = TextureManager.loadTexture(groundLoc, Texture.MinificationFilter.BilinearNearestMipMap , Texture.MagnificationFilter.Bilinear);
      
      texture.setScale(new Vector3f(1.0f,1.0f,1.0f));
      
      wallTexture.setTexture(texture);
      wallTexture.setEnabled(true);
      
      

      loadXML("Walls2.xml");
      walls.updateModelBound();
   }
   
   public void loadXML(String xmlFile) {     
      // Load XML
      try{
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         
         InputStream test = Main.class.getClassLoader().getResource(xmlFile).openStream();
         document = builder.parse(test);
      }catch(Exception e) {
         System.out.println(e.getMessage());
      }

      // Load Walls
      NodeList wallList = document.getElementsByTagName("Wall");
      for(int i=0;i<wallList.getLength();i++) {
         NodeList wall = wallList.item(i).getChildNodes();
         String name = wall.item(1).getFirstChild().getNodeValue();
         
         NodeList coords1 = wall.item(3).getChildNodes();
         NodeList coords2 = wall.item(5).getChildNodes();
         Vector3f pos1 = new Vector3f(Float.valueOf(coords1.item(1).getFirstChild().getNodeValue()),Float.valueOf(coords1.item(3).getFirstChild().getNodeValue()),Float.valueOf(coords1.item(5).getFirstChild().getNodeValue()));
         Vector3f pos2 = new Vector3f(Float.valueOf(coords2.item(1).getFirstChild().getNodeValue()),Float.valueOf(coords2.item(3).getFirstChild().getNodeValue()),Float.valueOf(coords2.item(5).getFirstChild().getNodeValue()));
         
         String type = wall.item(7).getFirstChild().getNodeValue();
         if(type.equals("Normal")) {
            walls.attachChild(Test.createWall(name, pos1, pos2, wallTexture,game));
         }
      }
      
      //game.getDisplay().getRenderer().getCamera().setLocation(new Vector3f(0,6,0));
   }
   
   public static Box createWall(String name,Vector3f pos1,Vector3f pos2,TextureState texState,StandardGame game) {
      // Front Wall
      Box wall = new Box(name,pos1,pos2);
      wall.setModelBound(new BoundingBox());
      wall.updateModelBound();

      CullState culling = game.getDisplay().getRenderer().createCullState();
      culling.setCullFace(CullState.Face.Back);
      wall.setRenderState(culling);
      
      wall.setRenderState(texState);
      wall.updateRenderState();

      return wall;      
   }
}



And as a attachment is the Walls2.xml (with .txt ending, which contains the coords for the walls) and the texture-image.

Maybe you get the same error.

Dennis

My macbook does not like non-power of 2 images, kinda looks like what your having issues with (my macbook has ATI vcard…)

Hi,

Thanks!

Now it works, after ich changed my pictures so they are a power of 2.



Greets,

Dennis