5
\$\begingroup\$

I'm not sure if I'm missing it somewhere or if this just doesn't exist, but I'd like to support "retina" graphics on desktop displays that support them (like the newer MacBook Pro), but I can't find a way to change the density of the LWJGL canvas in Libgdx.

Is this possible? How can I do it?

\$\endgroup\$
3
\$\begingroup\$

I know this post is old, but I found it when having the same issue. I luckily found this option after:

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useHDPI = true;

Maybe this was not available at the time, but it did solve my problem! Now my textures look super sharp.

\$\endgroup\$
2
\$\begingroup\$

Retina Graphics is just a fancy word for high pixel density. What makes your game support high density displays is the resolution of your assets, not the engine.

\$\endgroup\$
  • 1
    \$\begingroup\$ I understand the meaning, but I am unable to get the engine to display the game's canvas in a non-pixel-doubled format. \$\endgroup\$ – Evan Walsh Dec 21 '13 at 21:20
2
\$\begingroup\$

I may be way off the mark here but this comes from my experience with PlayN (which seems very similar to libGDX).

Though Retina means double resolution you treat it as if the resolution were the same as a non-retina device. Apples core libraries will even tell you that the screen if half the size as it actually is!

When you load an image asset, say "Sprites.png", iOS will actually first look for a file called "Sprites@2x.png" and use that file instead.

When coding for iOS you're are no longer working in pixels - but in points - and its up to iOS how big a point is depending on the context.

So all you need to do is provide versions of all of your image assets at twice the resolution with a slightly different file name e.g. "Sprites.png" and "Sprites@2x.png". The iOS will do the rest :D

I hope that makes sense... I didn't get much sleep last night :)

\$\endgroup\$
0
\$\begingroup\$

If you use an OrthographicCamera to display the scene, it has a zoom option, have you tried looking into it?

\$\endgroup\$
  • \$\begingroup\$ I have tried this, but it does not change the pixel density, from what I can tell. \$\endgroup\$ – Evan Walsh Dec 19 '13 at 20:42
0
\$\begingroup\$

It's a problem with JAVA apps being scaled twice by retina displays. I presume your talking about the desktop version right? I currently have the same issue, it's super blurry. The solution is to turn off retina scaling for java apps, currently trying to figure this out.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.