Important: Please read the Qt Code of Conduct -

Opengl and PGM display

  • Hello guys.
    I want to show some pgm image using OpenGL.
    I achieved that pretty easy with this:

    void OGLPyramid::display(const QImage* img)
        m_image = img;
    void OGLPyramid::paintEvent(QPaintEvent *)
        QPainter painter(this);
        painter.drawImage(this->rect(), *m_image);

    But i got a question - how can i specify display range? like if image got brightness distribution is between 0 and 65535 it looks pretty much okay, but if distribution is between 5000 and 5500 it looks black since display range stays from 0 to 65535. How can i adjust display range? Ofc would be nice to avoid changing the initial img data.

    Thanks for your help.

Log in to reply