Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LibGDX - Desktop resolution problems  (Read 1615 times)
0 Members and 1 Guest are viewing this topic.
Offline Davitsu

Junior Devvie


Medals: 4
Projects: 2



« Posted 2013-09-05 08:58:27 »

I've seen many topic talking about that kind of problem but I don't know what is exactly mine. So, can you help me? I'm making a game with LibGDX for desktop. It's a platformer where there is an OrtographicCamera(854, 480) and, LwjglApplicationConfiguration size (window size, I think) is the same, 854x480.

Here you have the game with standard resolution:



Now, I change LwjglApplicationConfiguration resolution x2 (1708x960):



Sprites look nice too but, when I use another resolution, x1.5 for example (1281x720):



Pixels get crazy... there is a way in order to don't deform textures (or smooth them) no matter what is the LwjglApplicationConfiguration size?
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2013-09-05 12:40:27 »

Use "Nearest" filtering.


When you load your textures you usually can supply TextureParameters:

1  
2  
3  
4  
5  
6  
7  
8  
// For example if you use an AssetManager
AssetManager manager = new AssetManager();

TextureParameters param = new TextureParameters();
param.minFilter = Texture.TextureFilter.Nearest;
param.magFilter = Texture.TextureFilter.Nearest;

manager.load("whatever.png", Texture.class, param);

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline netikan

Senior Newbie


Medals: 1


Zombies!


« Reply #2 - Posted 2013-09-05 15:30:06 »

In the resize() method, re-declare your orthographic camera with the new resolution.

Check out my project Land of Zom - Multiplatform Zombie MMO/RPG!
Soon to be at Eurogamer 2013.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Davitsu

Junior Devvie


Medals: 4
Projects: 2



« Reply #3 - Posted 2013-09-06 08:32:22 »

matheus23: I tried use nearest filter but the result was the same. Then, I tried linear filter and:



Linear gave me a nice result (I think nearest is the default filter). Thanks for your help ^^!!

netikan: But that will change the camera size, I want the camera has always the same size, window size is what I want to change.

If anybody knows other solutions feel free to tell me, please! But for now, Linear filter is doing a good job : D
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #4 - Posted 2013-09-06 09:41:28 »

Well, to actually explain what Nearest and Linear do:

When downscaling (or upscaling) Images, you can decide how the graphics card is going to do it:

When set to Nearest, the graphics card will simply look for the texel that is the nearest to the pixel it should be placed to.

When set to Linear, the graphics card will look at the surrounding texels and try to linearly interpolate the colors and set the pixel color to the computed color.

That's why Linear appears smoother.
Though I thought that that's not the effect you wanted to have. It looked like your game is a little more retro, and usually you use Nearest Filtering in retro games, since this is mostly how 'retro' games look.

Anyways, glad to help Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Davitsu

Junior Devvie


Medals: 4
Projects: 2



« Reply #5 - Posted 2013-09-06 22:00:23 »

You was right. Nearest filter is what I was looking for but I dont want that textures get deformed. If I don't find other way I think I'll let use only two resolutions, 854x480 and 1708x960 (x2). After trying Linear filter in depth It gave me graphic errors like lines around textures...
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!