Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Enabling vsync
Forum Updated to NodeBB v4.3 + New Features

Enabling vsync

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 456 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    black_gay
    wrote on last edited by black_gay
    #1

    Id like to know if the settings below are enough to enable vsync for qt application:

    evel1::Level1()
    {
        this->setSceneRect(sceneRect);
        m_view = new QGraphicsView();
     
        QOpenGLWidget *gl = new QOpenGLWidget();
        QSurfaceFormat format;
        format.setProfile(QSurfaceFormat::CompatibilityProfile);
        format.setOptions(QSurfaceFormat::DeprecatedFunctions);
        format.setDepthBufferSize(24);
        format.setStencilBufferSize(8);
        format.setVersion(3, 2);
        format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
        format.setSwapInterval(1);
        gl->setFormat(format);
         QSurfaceFormat::setDefaultFormat(format);
        m_view->setViewport(gl);
     
     
        m_view->setScene(this);
        m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        m_view->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "game"));
        m_view->resize(800, 600);
        m_view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
        m_view->setViewportUpdateMode(QGraphicsView::NoViewportUpdate );
        m_view->setCacheMode(QGraphicsView::CacheBackground);
        m_view->updateGeometry();
        painter = new QPainter();
        m_view->setSceneRect(0,0,10000000,10000000);
        m_view->setBackgroundBrush(Qt::black);
        m_view->show();
        m_view->showFullScreen();
     
     
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved