[SOLVED] Mipmaps of QOpenGLTexture getting darker on minification
-
Hi,
i am encountering a strange problem using QOpenGLTexture.
When drawing rects, smaller than the original texture size, the texture is getting darker until - if the image is small enough - it is drawn in black. Rendering the textures in original size it is ok. And, nevertheless... using my code without changes on my android device will also show smaller images in the right way.
Googling the problem gave me the hint, that the problem might be a problem with missing mipmaps.
I've initialized the texture objects right as the docs said:
@
m_pPointTexture = new QOpenGLTexture(QImage(":/images/mask"));
m_pPointTexture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
m_pPointTexture->setMagnificationFilter(QOpenGLTexture::Linear);
@The image is taken from a resource, and the member variable of course is a pointer type.
Hope someone can help me.
Best regards,
Coast -
Hmm, that ctor should call QOpenGLTexture::generateMipMaps() for you. Can you run your application through apitrace and see if glGenerateMipmaps() does actually get called as a result please? You should also be able to inspect each mipmap level of your texture from within qapitrace.
-
Eventually that ctor should end up in QOpenGLTexture::setData() which has this logic near the end:
@
// If requested perform automatic mip map generation
if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
Q_Q(QOpenGLTexture);
q->generateMipMaps();
}
@ -
Boah... totally forgot about that thread I opened some time ago:
The problem was hardware/driver. Got a new graphics card and everything was fine. So, this one is solved ZabP, thank you for your replies.