I want to set up a (parallel projection) camera so that it renders a certain size on the screen, and has a resolution independent of it’s screen size.
For example, the following window has a camera that has a screen size of 320x240 and also a resolution of 320x240:
My goal is to modify the camera settings such that it’s screen size remains 320x240, but it’s resolution is reduced to only a quarter of that, to 80x60 like so:
To start with, I call camera.resize(80, 60, true). This gets me part of the way, since the camera has indeed reduced it’s resolution to 80x60, however it’s on-screen size has also reduced to match:
To counter this, I call camera.setViewPortSize(0, 4, 0, 4) to increase the camera’s view port to stretch it back out to the original size. After this I get the following:
Unfortunately that isn’t what I was hoping for, but I kind of get it - the camera is rendering an image as seen through a window of size 80x60, but that 80x60 isn’t pixels it’s world coordinates. So, the circle comes out as smooth as it exists in the world.
Is it possible to achieve what I want and configure the camera with a fixed pixel resolution?
A workaround is to render to a frame buffer at the appropriate resolution, and then I can place/size the output to whatever I want. That’s fine, however I’d prefer a direct solution because an FBO will be more work to implement, maintain, and also handle extra stuff like picking objects with rays.