PDA

View Full Version : Why the result of display is not anti-aliased?



superwave
19th August 2011, 23:52
grCanvas derived from QGLWidget.


void grCanvas::paintEvent(QPaintEvent* event)
{
QPainter ipainter(this);
ipainter.begin(this);
ipainter.setWindow(QRect(this->translate.X-iMargin,this->translate.Y-iMargin,zoom.X+2*iMargin,zoom.Y+2*iMargin));

//ipainter.setRenderHint(QPainter::SmoothPixmapTrans form, true);
ipainter.setRenderHint(QPainter::Antialiasing);
CanvasDrawer->RefreshCanvas(this);

CanvasDrawer->RunOpenGL(&ipainter,ShowLens);
if(ShowLens==TRUE)
ipainter.drawImage(m_pos - QPointF(m_radius, m_radius), m_lens_image);
}


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

the display is like this:http://www.qtcentre.org/attachment.php?attachmentid=6778&d=1313790664

Why the QPainter::Antialiasing fail to act?

Looking for your advice.

Thanks a lot.

wysota
20th August 2011, 01:29
You need to enable supersampling for your GL context for antialiasing to work with OpenGL.

superwave
20th August 2011, 04:44
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.

wysota
20th August 2011, 09:53
It doesn't matter, your widget is a QGLWidget.