Trying to use glBlitFramebuffer for antialiasing

I am not sure what I am doing wrong, but my texture out of the fbo is like 1/4 the size. To start with, just to get this working I was trying to just do the size 1:1 before I use the GL_LINEAR.

In the “newOpenGLContextCreated”, I am creating a new frame buffer, with:

juce::OpenGLContext* ownerContext = juce::OpenGLContext::getCurrentContext();
fb.initialise(*ownerContext, getWidth(), getHeight());

Later on in the render, to switch to this, I just do:

fb.makeCurrentRenderingTarget();

Then at the end of the render routine, I try doing this:

juce::gl::glBindFramebuffer(juce::gl::GL_READ_FRAMEBUFFER, fb.getFrameBufferID());
juce::gl::glBindFramebuffer(juce::gl::GL_DRAW_FRAMEBUFFER, 0);

juce::gl::glBlitFramebuffer(0,0,getWidth(),getHeight(),0,0,getWidth(),getHeight(),juce::gl::GL_COLOR_BUFFER_BIT,juce::gl::GL_LINEAR);
fb.releaseAsRenderingTarget();

And what I see is 1/4 of the original render in the bottom left of the screen. No amount of playing with glViewport fixes the problem.

Given everything is 1:1 right now, I just have no clue what I have done wrong. (I could see needing to adjust the glViewport once my FBO is twice the size or bigger for downsampling)

Anyone have any idea what I could be doing wrong here?

You need to account for DPI scaling manually when rendering into framebuffers.

Most OSs are doing some scaling now. It is ubiquitous on macOS (Retina displays).

Is there somewhere else I can determine scaling? I tried this:

openGLContext.getRenderingScale();

And it just said 1.0 when I checked.

I see, I was calling it during “newOpenGLContextCreated” and in there it is set to 1, but during the rendering routing, it is 2. I believe it probably makes sense to change the buffer as the window could move between screens and then that target would be different.