How can I flip a texture I assign in the code? I’ve scanned through all of the Material help classes, and checked for methods in Material.class and Texture2D.class but neither of them seem to have a way to flip an assigned texture in the code.
You can specify, if the texture should be flipped when loading it with the assetManager:
[java]assetManager.loadTexture(new TextureKey(filePath, false))[/java]
The second parameter of this TextureKey constructor is flipY - It’s true by default.
Hope, that helps.
1 Like
@destroflyer The problem is that I’m not loading the texture. I load an image, modify it some, then call:
[java]
material.setTexture(“DiffuseMap”, new Texture2D(myImage));
[/java]
Thanks anyway, I probably should’ve been more specific in the explanation.
Nevermind! I figured it out. I just had to invert the written pixels on the ImageRaster. (Intead of setPixel(x, y, newColor) I made it setPixel(x, widthOfImage-y, newColor)). Thanks anyway!