I am trying to use QNanoImage to perform some zooming operations on a QOpenGLFramebufferObject. I can see that when I load an image from a file and scale the image (using painter->scale), linear filtering is used by default and the image is scaled "smoothly" (similar to the QML standard smooth: true). Now when I try to do the same thing using an fbo, it seems that nearest filtering is always used: the image appears pixelated. The code I am using is the following:
QNanoImage cacheImage = QNanoImage::fromFrameBuffer(m_cacheBuffer.get(),
QNanoImage::FLIPY |
QNanoImage::GENERATE_MIPMAPS);
painter->scale(m_contentScale);
painter->drawImage(cacheImage,0,0);
So I decided to blit the fbo directly using:
QOpenGLFramebufferObject::blitFramebuffer(fbo,QRect(0,0,1000,1000),
m_cacheBuffer.get(), QRect(0,0,width()/m_contentScale, height()/m_contentScale),
GL_COLOR_BUFFER_BIT,
GL_LINEAR);
which actually uses linear filtering and the image appears "smoothly" scaled (it works only if I explicity set GL_COLOR_BUFFER_BIT as the GLbitfield). I don't have too much experience with OpenGL, so I am not sure why would that be the case. Could this be due to format that my fbo is created with?
I am trying to use
QNanoImageto perform some zooming operations on aQOpenGLFramebufferObject. I can see that when I load an image from a file and scale the image (usingpainter->scale), linear filtering is used by default and the image is scaled "smoothly" (similar to the QML standardsmooth: true). Now when I try to do the same thing using an fbo, it seems that nearest filtering is always used: the image appears pixelated. The code I am using is the following:So I decided to blit the fbo directly using:
which actually uses linear filtering and the image appears "smoothly" scaled (it works only if I explicity set
GL_COLOR_BUFFER_BITas theGLbitfield). I don't have too much experience with OpenGL, so I am not sure why would that be the case. Could this be due to format that my fbo is created with?