Results 1 to 8 of 8

Thread: OPEnGL low picture quality

  1. #1
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default OPEnGL low picture quality

    Hi all,

    I'm using Qt 5 on WInXP 32 bit.
    I'm rendering bitmap image in the window.
    The problem is that the quality of the picture is poor. I have made the program using WInAPI and OpenGL and the picture looks like original.
    It seems that the resolution of the picture is low.
    I have tryied to change the QSurfaceFormat. The strange thing when i get it from the QWindow the Red/Green/Blue buffer sizes are set to -1.
    I have changed the surface format like the following:
    Qt Code:
    1. m_context = new QOpenGLContext(this);
    2. QSurfaceFormat format = requestedFormat();
    3. format.setBlueBufferSize(8);
    4. format.setRedBufferSize(8);
    5. format.setGreenBufferSize(8);
    6. format.setAlphaBufferSize(8);
    7. format.setDepthBufferSize(8);
    8. format.setRenderableType(QSurfaceFormat::OpenGL);
    9. format.setSamples(16);
    10.  
    11. setFormat(format);
    12. m_context->setFormat(format);
    To copy to clipboard, switch view to plain text mode 

    The quality is still low.
    Here is the screenshot.

    bmp_opengl_problem.jpg

    The upper is rendered using QT engine the lower is from my WinAPI application.
    I can't exactly understand why the upper image looks poor? Is that color or resolution problem?
    It seems to me that the pixel sizes on the upper image are bigger.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: OPEnGL low picture quality

    Please provide a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OPEnGL low picture quality

    Hello wysota,

    I have simplified the problem.
    I draw a short vertical line and i see that the thickness of this line is two times bigger than it should be.
    I have attached two source files.
    I'm trying to change surface format but it has no effect.
    Maybe it is sampling problem but it is disabled by default.
    Let me know if there is a problem with compiling the sources.
    Attached Files Attached Files

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: OPEnGL low picture quality

    In your original images it looks like the top button has been scaled up from its native size, and the lower image has not. The interpolation and anti-aliasing that results could easily lead to blurry results.

  5. #5
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OPEnGL low picture quality

    I have solved the problem with the line thickness. I forgot to add 0.5f to the coordinates.
    But the bmp is still blurry.
    How could i disable interpolation and anti aliasing?

    I have solved the problem with the line thickness. I forgot to add 0.5f to the coordinates.
    But the bmp is still blurry.
    How could i disable interpolation and anti aliasing?


    Added after 54 minutes:


    Now i'm sure that there is interpolation problem.
    I have compared two pictures.
    To the right there is colors are interpolated.
    It seems that QT OpenGL doing that by default.
    Attached Images Attached Images
    Last edited by zulunation; 23rd October 2014 at 14:07.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: OPEnGL low picture quality

    Qt is not issuing any OpenGL calls. You are.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Sep 2014
    Posts
    14
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: OPEnGL low picture quality

    Yes but i don't do any specific calls. The native WinAPI application shows no interpolation with the same code.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: OPEnGL low picture quality

    Apparently the code is not the same. To me it seems the second image is still stretched while the first is not.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 8th February 2014, 09:00
  2. A Way To Set A Picture Without Overriding Last Picture?
    By AMacias in forum Qt Programming
    Replies: 5
    Last Post: 10th December 2012, 12:30
  3. Replies: 3
    Last Post: 8th March 2012, 23:51
  4. How to create PIP (Picture In Picture) on QwebView
    By luckychap in forum Qt Programming
    Replies: 0
    Last Post: 18th July 2011, 12:47
  5. Poor OpenGL quality on Mac OS 10.5.8, even demos
    By MattPhillips in forum Installation and Deployment
    Replies: 3
    Last Post: 6th March 2010, 04:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.