How can I position framebuffer objects on the screen in OpenGL?

I currently have two framebuffers which are drawn using

glBlitFramebuffer(0, 0, 1920, 1080, 0, 0, 1920, 1080,
GL_COLOR_BUFFER_BIT, GL_NEAREST);


But the texture does not take up the whole screen, and I would like to position it at a certain x,y on the screen. The images by default start from 0,0 and then span the width/height provided, however I would like the image to start at say, [100, 100] and span the width/height provided.

How would I do this?

• – 3Dave Jul 27 '18 at 18:57

The last 4 positional parameters to the function are for destination position. The position can be changed using this, but the image pixels must be exact or the image won't be displayed.

void Graphics::fboToScreen(GLuint fbo){
int w, h; getWindowSize(w, h);
int startAtX = 100;
int startAtY = 100;
glBlitNamedFramebuffer(fbo, 0, 0, 0, w, h, startAtX, startAtY, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}