const Image: TCastleImage; const GUITexture: boolean;
out ImageRightSize: TCastleImage; out ImageRightSizeFree: boolean);
if GUITexture then
Sizing := tsAny else
Sizing := tsScalablePowerOf2;
if IsTextureSized(Image, Sizing) then
ImageRightSize := Image;
ImageRightSizeFree := false;
ImageRightSize := ResizeToTextureSize(Image, Sizing);
ImageRightSizeFree := true;
Because when textures do not have “power of 2”, we cannot use mipmaps, which makes them look unacceptably bad in some cases (when the texture may be arbitrarily small on the screen; this commonly happens in 3D, but also in some 2D uses).
Other game engines also either resize, or they don’t create mipmaps – in either case, some use-case is hurt.
You can always disable this feature:
If you use
If you have access to X3D nodes like
TImageTextureNode, you can set
true, like this:
var MyImageTexture: TImageTextureNode; MyTextureProperties: TTexturePropertiesNode; begin ... // initialize MyImageTexture MyTextureProperties := TTexturePropertiesNode.Create; MyTextureProperties.GuiTexture := true; MyImageTexture.TextureProperties := MyTextureProperties; end;
- Note that in some cases, we disable this by default. E.g. when using
TCastleImageControl, or when loading image or sprite sheet to
Please put more context in your questions, so that we can help better Terse question like this makes it harder for me to advise the solution, as I have to guess in what context did you encounter this problem.
If you want specific advise how to deactivate it in your case, please describe / show code how you are using the texture.