Texture.AM_COMBINE(?) + FengGUI(?) problem

The FengGUI window becomes weird while I look at the terrain.



It is not weird while not looking at the terrain.



Code for building terrain:


      // Generate a random terrain data
       FaultFractalHeightMap heightMap = new FaultFractalHeightMap(257,
             32, 0, 255, 0.75f);
      heightMap.setHeightScale(0.001f);
      Vector3f terrainScale = new Vector3f(10, 1, 10);
      // create a terrainblock
      /*tb = new TerrainBlock("Terrain", heightMap.getSize(), terrainScale,
            heightMap.getHeightMap(), new Vector3f(0, 0, 0), false);*/
      page = new TerrainPage("terainpage", 33,
            heightMap.getSize(), terrainScale,
            heightMap.getHeightMap(), false);

       page.setModelBound(new BoundingBox());
      page.updateModelBound();

      // generate a terrain texture with 2 textures
      ProceduralTextureGenerator pt = new ProceduralTextureGenerator(
            heightMap);
      pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
            .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);
      pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
            .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);
      pt.addTexture(new ImageIcon(TestTerrain.class.getClassLoader()
            .getResource("jmetest/data/texture/highest.jpg")), 128, 255,
            384);
      pt.createTexture(256);
      
      // assign the texture to the terrain
      TextureState ts = display.getRenderer().createTextureState();
      ts.setEnabled(true);
      Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
            Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true);
      ts.setTexture(t1, 0);

      Texture t2 = TextureManager.loadTexture(TestTerrain.class
            .getClassLoader().getResource("jmetest/data/texture/Detail.jpg"),
            Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
      ts.setTexture(t2, 1);
      t2.setWrap(Texture.WM_WRAP_S_WRAP_T);

      t1.setApply(Texture.AM_COMBINE);
      t1.setCombineFuncRGB(Texture.ACF_MODULATE);
      t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
      t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
      t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
      t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
      t1.setCombineScaleRGB(1.0f);

      t2.setApply(Texture.AM_COMBINE);
      t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
      t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
      t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
      t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
      t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
      t2.setCombineScaleRGB(1.0f);
      page.setDetailTexture(1, 4);
      page.setRenderState(ts);
      page.setLocalTranslation(-220.0f, -520.0f, -220.0f);



I found that the line:


      t2.setApply(Texture.AM_COMBINE);


makes the FengGUI window normal, but the terrain and the FengGUI becomes darker, like so:


but only when looking at the terrain. Though while not looking at the terrain, the mouse becomes invisible


Hi,



There is a workaround for this. Its something to do with the alpha blending.



You need to render the fenggui as pass I beleive. checjk out the fenngui thread http://www.fenggui.org/forum/index.php?topic=13.30

Thanks