Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Antialiasing with direct drawing on Windows?



  • Is subj supprted?

    I draw a text from beforeRendering() handler with a code like this:

    void LightGrid::beforeRendering()
    {
        {
            QOpenGLContext * p_context = QOpenGLContext::currentContext();
            assert(p_context != nullptr && p_context->isValid());
            assert(!p_context->isOpenGLES());
    
            QOpenGLFunctions * gl = p_context->functions();
            gl->glEnable(GL_MULTISAMPLE);
            gl->glEnable(GL_LINE_SMOOTH);
    
            assert(gl->glIsEnabled(GL_MULTISAMPLE));
            assert(gl->glIsEnabled(GL_LINE_SMOOTH));
        }
    
        const QSize window_size = window()->size();
        QOpenGLPaintDevice device(window_size);
        QPainter painter(&device);
        painter.setRenderHint(QPainter::Antialiasing);
        painter.setRenderHint(QPainter::TextAntialiasing);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
    
        //Draw the text with QPainter::drawText
    

    in main.cpp I set:

        QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    

    but the text is not antialiased at least on Windows 10.

    How to check if I have OpenGL properly installed on my machine?


Log in to reply