Consider a ray tracer written in OpenGL and using GLFW as a window toolkit. There are basically 2 options to display the ray-traced image.
1) Create a
RenderBuffer with image and blit this to the default framebuffer.
2) Render the scene to a texture and use a full screen quad to display that texture.
What if I want to render the scene in a resolution that is different from the window size? How do I handle rescaling of images.
Case 1) Render to high resolution image/texture and display to low resolution window.
I don't know how should I handle for downscaling the texture/image in both cases. I am particularly interested in the
Renderbuffer approach though.
Case 2) Render to low resolution image/texture and display to high resolution window.
I am pretty sure case 2 could be easy to implement through textures by setting the filter to
NEAREST perhaps, the sampling function would automatically upscale it?
I am not sure what would happen to the renderBuffer approach in either case. I have read though that
Blit between buffers of different sizes are supported.
Also in both cases, how would I handle the aspect ratio?
EDIT:- What I mean by handling aspect ratio is, to my knowledge there are two ways I could handle it.
1) Either stretch the whole image to fit the window.
2) Or make it "fit" to the window like Windows 7 wallpaper setting. This way the original aspect ratio of the Image will be maintained. Any space not covered by the image would be black in the window.
Here is a crappy painting to show what I mean.
Now if the Red window is my RBO/Texture and Black Window is the actual window ( default framebuffer) opened by GLFW. Left and right show two cases when either the RBO is greater or smaller than the default framebuffer with varying aspect ratio.
There are two ways, Either fit or stretch. I want to know if OpenGL provides functions for these sorts of settings or it does some or part of these things automatically. Plus I want to know this thing for both
Case 1) RBO
Case 2) Texture.