LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: CodeBunny on April 21, 2011, 00:54:07

Title: Small Display question
Post by: CodeBunny on April 21, 2011, 00:54:07
Is there a way to scale the Display? E.g., can I make a window at 300x200 and then scale it x3 so it is, in effect, a 900x600 window? I've seen this done before and it's an interesting effect - mainly for "pixely" games. (Example: Spelunky.)
Title: Re: Small Display question
Post by: kappa on April 21, 2011, 08:20:36
One way you can do this is just create a 900x600 window and scale your small content using GL11.glViewport to stretch and fit window.
Title: Re: Small Display question
Post by: CodeBunny on April 21, 2011, 15:55:29
Yeah, and I've done some playing around with that, but it doesn't end up pixelated. It ends up being a 900x600 window where things are 3 times larger but at full resolution.

Example:

This is the method you suggested:
(http://img97.imageshack.us/img97/4118/displayscaling1.png)

This is how I'd like to get it to look:
(http://img718.imageshack.us/img718/2853/displayscaling2.png)
Title: Re: Small Display question
Post by: Matthias on April 21, 2011, 16:29:05
Then you need to render to texture (RTT) (best using FBO - Frame Buffer Objects). And render that texture to your screen using GL_NEAREST filter.
Title: Re: Small Display question
Post by: CodeBunny on April 21, 2011, 16:32:00
Ah. I was hoping there would be a built-in way. *shrug*

Is there any way that this feature could get added in the next release? It seems like it'd be a simple thing to achieve on the Display side - simply show the render results on the screen at a different scale.