Results 1 to 4 of 4

Thread: Why the result of display is not anti-aliased?

  1. #1
    Join Date
    May 2011
    Location
    North Carolina
    Posts
    23
    Thanks
    10
    Qt products
    Qt4

    Default Why the result of display is not anti-aliased?

    grCanvas derived from QGLWidget.

    Qt Code:
    1. void grCanvas::paintEvent(QPaintEvent* event)
    2. {
    3. QPainter ipainter(this);
    4. ipainter.begin(this);
    5. ipainter.setWindow(QRect(this->translate.X-iMargin,this->translate.Y-iMargin,zoom.X+2*iMargin,zoom.Y+2*iMargin));
    6.  
    7. //ipainter.setRenderHint(QPainter::SmoothPixmapTransform, true);
    8. ipainter.setRenderHint(QPainter::Antialiasing);
    9. CanvasDrawer->RefreshCanvas(this);
    10.  
    11. CanvasDrawer->RunOpenGL(&ipainter,ShowLens);
    12. if(ShowLens==TRUE)
    13. ipainter.drawImage(m_pos - QPointF(m_radius, m_radius), m_lens_image);
    14. }
    To copy to clipboard, switch view to plain text mode 

    the code to draw texts, edges, nodes are inside the function RunOpenGL(&ipainter,ShowLens)

    the display is like this:

    Why the QPainter::Antialiasing fail to act?

    Looking for your advice.

    Thanks a lot.

  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: Why the result of display is not anti-aliased?

    You need to enable supersampling for your GL context for antialiasing to work with OpenGL.
    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. The following user says thank you to wysota for this useful post:

    superwave (20th August 2011)

  4. #3
    Join Date
    May 2011
    Location
    North Carolina
    Posts
    23
    Thanks
    10
    Qt products
    Qt4

    Default Re: Why the result of display is not anti-aliased?

    Quote Originally Posted by wysota View Post
    You need to enable supersampling for your GL context for antialiasing to work with OpenGL.


    I am sorry, actually there is no opengl code in the function "RunOpenGL"

    thank you all the same.

  5. #4
    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: Why the result of display is not anti-aliased?

    It doesn't matter, your widget is a QGLWidget.
    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.


  6. The following user says thank you to wysota for this useful post:

    superwave (20th August 2011)

Similar Threads

  1. Replies: 2
    Last Post: 22nd June 2011, 21:43
  2. Replies: 1
    Last Post: 20th September 2010, 07:46
  3. Replies: 4
    Last Post: 17th September 2010, 20:18
  4. How to display result
    By sksingh73 in forum Newbie
    Replies: 1
    Last Post: 7th June 2010, 08:39
  5. Qt 4.6 on Ubuntu, no colors and aliased
    By afail in forum Installation and Deployment
    Replies: 1
    Last Post: 8th January 2010, 11:17

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.