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. GlClampColor missing in QT
Qt 6.11 is out! See what's new in the release blog

GlClampColor missing in QT

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Arun Yoganandan
    wrote on last edited by
    #1

    Hello All,

    I'm working on a Render to Texture in QT with QGLWidget and a QGLFramebufferObject. My intention is to write floating point values to the texture via a shader.

    I use a GL_RGB32F texture and the RTT seems to be happening. However, the values stored in the texture seem to be clamped between 0 and 1.

    A test value of gl_FragData[0] = vec4(120.0, 2.0, 0.8, 1.0); in the shader results in 1.0, 1.0, 0.8 in the texture.

    I see posts that suggest that calls to glClampColor

    glClampColorARB(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE); glClampColorARB(GL_CLAMP_READ_COLOR, GL_FALSE);

    will get rid of this clamping, but unfortunately I'm not able to find this call in QT 5.0.2. It seems to be removed after QT 4.3 inside QOpenGLFunctions

    How can I achieve this? Any help would be much appreciated.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mmoll
      wrote on last edited by
      #2

      Non-QT related answer, but how do you inspect the values? If you download the texture using glReadPixels, then the clamping may very well occur while downloading (see e.g. glPixelTransfer). Perhaps you should try glGetTexImage.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Arun Yoganandan
        wrote on last edited by
        #3

        Thanks! glGetTexImage seemed to help. It is a bit slower, but works nevertheless.

        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