1
\$\begingroup\$

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?

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$
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);
}

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.