Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Mipmaps of QOpenGLTexture getting darker on minification

[SOLVED] Mipmaps of QOpenGLTexture getting darker on minification

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Coastcrawler
    wrote on last edited by Coastcrawler
    #1

    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

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      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.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        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();
        }
        @

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Coastcrawler
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved