Ich möchte vsync
aus dem QOpenGLContext-Format deaktivieren, um die Integration eines Drittanbieter-Rendering-System zu erleichtern.Qt 5: Vsync deaktivieren
QSurfaceFormat::swapInterval
scheint der einzige verwandte Parameter in Qt zu sein.
Ich habe versucht, mehrere Möglichkeiten, dies zu implementieren, aber selbst wenn ich die QSurfaceFormat::swapInterval(0)
in einem frühen Stadium (vor der QMainWindow
Konstruktion), dann der QOpenGLContext::create()
Aufruf stellt es wieder her.
// at application startup, before creating the Qt windows (or in MyQWindow constructor)
QSurfaceFormat format;
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
format.setAlphaBufferSize(8);
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
QMainWindow *w = new QMainWindow;
w->show();
// at QWindow with QOpenGLContext creation, at the first frame update (or at the constructor)
MyQWindow::initialization() {
WbOpenGLContext *c = new WbOpenGLContext(this);
c->setFormat(requestedFormat());
qDebug() << "requested format:" << c->format();
c->create();
qDebug() << "actual format:" << c->format();
}
# output
requested format: QSurfaceFormat(
version 2.0,
options QFlags(),
depthBufferSize 24,
redBufferSize 8,
greenBufferSize 8,
blueBufferSize 8,
alphaBufferSize 8,
stencilBufferSize 8,
samples -1,
swapBehavior 2,
swapInterval 0,
profile 0
)
context format: QSurfaceFormat(
version 3.0,
options QFlags(0x4),
depthBufferSize 24,
redBufferSize 8,
greenBufferSize 8,
blueBufferSize 8,
alphaBufferSize 8,
stencilBufferSize 8,
samples 0,
swapBehavior 2,
swapInterval 1, # Not what I asked
profile 0
)
Gibt es eine Möglichkeit Vsync zu zwingen deaktiviert sein?
Hinweis: Ich habe sowohl auf Mac und Windows versucht und das gleiche Verhalten erhalten. – FabienRohrer
In Verbindung stehende neue Frage: http://StackOverflow.com/Questions/37239900/qt-vsync-missing-Rende-frames – FabienRohrer
Ich denke, es ist nicht einmal möglich, vsync auf Mac tatsächlich zu deaktivieren? Siehe https://code.woboq.org/qt5/qtbase/src/plugins/platforms/cocoa/qcocoaglcontext.mm.html#176, was ebenfalls abwegig zu sein scheint (das Swap-Intervall wird nicht vom GL-Kontext aktualisiert) . – peppe