Textures are flipped horizontally ?!

Hi all

I’ve been through the forums and tried all sorts of things to fix this one. But no joy. I’ve tried all combinations of texture.setScale(), and a host of other things.

I have a simple heightmap generated terrain and a texture that I want to stick on the terrain. The code looks like this:

private TerrainPage getInitialTerrainPage(int worldtileX, int worldtileY) {

System.out.println(“Loading terrain page: 0101_”+worldtileX+“x”+worldtileY+".png");

// get the greyscale image for the particular world terrain tile

URL grayscale = TerrainManager.class.getClassLoader(). getResource(“resources/world/129/0101_”+worldtileX+“x”+worldtileY+".png");

// … and the accompanying texture

URL tex = TerrainManager.class.getClassLoader().getResource(“resources/world/129/0101tex_”+worldtileX+“x”+worldtileY+".png");

// create a texture state for the texture

TextureState ts1 = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

Texture t1 = TextureManager.loadTexture(tex, Texture.MM_LINEAR, Texture.FM_LINEAR);



// create an image height map based on the gray scale of our image.

ImageBasedHeightMap ib = new ImageBasedHeightMap(new ImageIcon(grayscale).getImage());

TerrainPage tp = new TerrainPage(“worldtile:”+worldtileX+","+worldtileY, 33, ib.getSize(), terrainscale, ib.getHeightMap(), false);


tp.setModelBound(new BoundingBox());


return tp;


This is how my terrain texture is turning out:

The words “This way up !” are written on the image. As you can see, it looks like it’s been flipped around the Y axis ?!

(The 5,5 is a grid reference. Yes, this is a very temporary texture ;))

Any thoughts ?



No one have any ideas on this ?


its just a wild guess, cause i never worked with Terrains before, but try to set the CullMode to CS_BACK.

that way, the Backside of an Object wont get rendered (or something :)).

    CullState cs = display.getRenderer().createCullState();

Maybe it helps

An adroit suggestion my friend, but alas I'm already doing this.

Thanks for your response though.




Texture t1 = TextureManager.loadTexture(tex, Texture.MM_LINEAR, Texture.FM_LINEAR, 1f, false);

by design

TextureManager.loadTexture(tex, Texture.MM_LINEAR, Texture.FM_LINEAR)


loadTexture(tex, Texture.MM_LINEAR, Texture.FM_LINEAR, (COMPRESS_BY_DEFAULT ? Image.GUESS_FORMAT : Image.GUESS_FORMAT_NO_S3TC), 1.0f, true);

where the boolean refer to @param flipped: If true, the images Y values are flipped.

Thank you so much !

I am embarrassed to admit that I assumed that the default value for flipped was false. I had repeatedly tried this call with true in there figuring that would correct the issue. What a putz !

Thanks again jmt