Rendering and displaying different resolutions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering and displaying different resolutions

captfoss
Hey all,

I'm using JOGL and I'm trying to figure out how I can render a scene to a lower resolution than I display the scene. IE, I'd like to render the scene at, say, 256x256, and then have that image automatically scale to fill a JPanel.

Currently, I can get the image to render at the smaller resoluton by resizing the viewport, or resizing the actual GLAutoDrawable... but I can't seem to find a way to make the viewport automatically upscale a low-res render buffer.

If any of that makes sense... I just like to set a small, fixed resolution for the scene and have that scale to fill the window.

 

Reply | Threaded
Open this post in threaded view
|

Re: Rendering and displaying different resolutions

Demoscene Passivist
Administrator
U have to render ur scene to some backbuffer, preferably a FBO (Frame Buffer Object).

The FBO could be any resolution (e.g. 256x256). After u rendered ur scene to the FBO u can use it as texture to render a fullscreen quad in ur "displayed" viewport (e.g. 1280x720). The lower resolution FBO will the be automatically upscaled with bilinear filtering to cover the whole screen.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering and displaying different resolutions

captfoss
Ok... thanks.

It sounds like this method would require two "render" operations... is it going to be much / any faster than just rendering the scene outright?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering and displaying different resolutions

Demoscene Passivist
Administrator
>is it going to be much / any faster than just rendering the scene outright?

... depends on the complexity of ur scene, but rendering to a FBO and doing a second render pass to display the fullscreen quad with the FBO as texture is basically free. U can do hundreds or even thousand of these passes per frame  on a modern GPU (as u would e.g. to achieve blur or other filter operations).
Reply | Threaded
Open this post in threaded view
|

Re: Rendering and displaying different resolutions

captfoss
It's a fairly complex scene (tri-strip terrain models)... but it has to run on a machine with a slow processor and no GPU or graphics acceleration of any kind...