feat(src/main): try to optimize opengl context

This commit is contained in:
Ronan Abhamon 2017-03-22 10:32:56 +01:00
parent afba34e03a
commit 53f804aa5a
2 changed files with 20 additions and 0 deletions

View file

@ -54,6 +54,7 @@ CameraRenderer::~CameraRenderer () {
QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &size) {
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA8);
format.setSamples(4);

View file

@ -30,11 +30,30 @@ using namespace std;
// =============================================================================
int main (int argc, char *argv[]) {
// Disable QML cache. Avoid malformed cache.
qputenv("QML_DISABLE_DISK_CACHE", "true");
// Options to get a nice video render.
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL, true);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
{
QSurfaceFormat format;
format.setSwapBehavior(QSurfaceFormat::TripleBuffer);
format.setSwapInterval(1);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
format.setAlphaBufferSize(8);
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(format);
}
App app(argc, argv);
app.parseArgs();