How to apply an independent pixel resolution to a camera

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:
ss1

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:
ss2

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:
ss3

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:
ss4

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.

i dont understand one thing.

when you will resize 80x60 into 320x240 it should be pixelated anyway(just smooth/etc depends how texture pixels are managed).

While in last screenshot its visible you have 320x240 rendered anyway, there is no blend between pixels.

Anyway can we know what you generally want achieve?
if this is minimap purpose, then there are better solutions overall.
if this is for Shader Ray way, there is also different solution as i seen.

Is it just that you want blocky retro style?

I think you have to render to a texture and then display the texture scaled up.

As you can see from the final image, it is not. There is no texture, just a solid coloured circular mesh.

Yes, kind of - Im after pixel perfect rendering but at a scale that can be seen more clearly.

Yeah, damn as I suspected :unamused: