Libgdx Distorted Texture When Using Camera.settoortho(false, Game_width, Game_height);
Solution 1:
It is distorted because you are using a fixed width and height for the camera, so it simply stretches to fit whatever size window/screen you're putting it on.
Incidentally, StretchViewport does the same thing (distorts the scene to fit the dimensions you gave it to the window). But you just created a viewport without actually calling update()
on it, so it's not doing anything.
You most likely want to use ExtendViewport or FillViewport to avoid stretching, but other options are available. Read about them here.
Your viewport won't properly respond to screen rotations (or desktop window resize) unless you put viewport.update(width,height)
into the resize method. And you have to call update
on it at least once regardless, using the actual screen dimensions. This is most convenient by simply putting viewport.update(width,height)
into the resize method.
Post a Comment for "Libgdx Distorted Texture When Using Camera.settoortho(false, Game_width, Game_height);"