TestWindow::TestWindow() { setSurfaceType(QSurface::OpenGLSurface); auto timer = new QTimer(this); timer->setTimerType(Qt::PreciseTimer); timer->setInterval(5); connect(timer, &QTimer::timeout, [&] { draw(); }); timer->start(); connect(qApp, &QCoreApplication::aboutToQuit, [this, timer] { timer->stop(); _aboutToQuit = true; }); #ifdef DEFERRED_LIGHTING _light->setType(graphics::Light::SUN); _light->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE); _light->setIntensity(1.0f); _light->setAmbientIntensity(0.5f); _light->setColor(vec3(1.0f)); _light->setPosition(vec3(1, 1, 1)); _renderContext->args = _renderArgs; #endif QSurfaceFormat format = getDefaultOpenGLSurfaceFormat(); format.setOption(QSurfaceFormat::DebugContext); //format.setSwapInterval(0); setFormat(format); _glContext.setFormat(format); _glContext.create(); _glContext.makeCurrent(this); show(); }
TestWindow::TestWindow() { Setting::init(); setSurfaceType(QSurface::OpenGLSurface); qmlRegisterType<QTestItem>("Hifi", 1, 0, "TestItem"); show(); _createStopTime = usecTimestampNow() + (3000u * USECS_PER_SECOND); resize(QSize(800, 600)); auto timer = new QTimer(this); timer->setTimerType(Qt::PreciseTimer); timer->setInterval(30); connect(timer, &QTimer::timeout, [&] { draw(); }); timer->start(); connect(qApp, &QCoreApplication::aboutToQuit, [this, timer] { timer->stop(); _aboutToQuit = true; }); }
TestWindow::TestWindow() { auto timer = new QTimer(this); timer->setTimerType(Qt::PreciseTimer); timer->setInterval(5); connect(timer, &QTimer::timeout, [&] { draw(); }); timer->start(); connect(qApp, &QCoreApplication::aboutToQuit, [this, timer] { timer->stop(); _aboutToQuit = true; }); setSurfaceType(QSurface::OpenGLSurface); QSurfaceFormat format = getDefaultOpenGLSurfaceFormat(); format.setOption(QSurfaceFormat::DebugContext); setFormat(format); _glContext.setFormat(format); _glContext.create(); _glContext.makeCurrent(this); show(); }