From 759b3f49c52c69f0a3ea2df014afbd3259e2bb83 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Apr 2016 09:27:18 +0200 Subject: OpenGL/contextinfo-Example: Add command line options and status label. Add command line options to be able to set the QCoreApplication attributes that influence Open GL context creation and add a status label at the bottom that displays it besides the QT_OPENGL environment variable. Task-number: QTBUG-52693 Change-Id: Id9793292596e0feb3da5220fde2e5b2e495f87ff Reviewed-by: Laszlo Agocs --- examples/opengl/contextinfo/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'examples/opengl/contextinfo/main.cpp') diff --git a/examples/opengl/contextinfo/main.cpp b/examples/opengl/contextinfo/main.cpp index 0a75e10b290..8451551b7b9 100644 --- a/examples/opengl/contextinfo/main.cpp +++ b/examples/opengl/contextinfo/main.cpp @@ -43,6 +43,15 @@ int main(int argc, char **argv) { + for (int i = 1; i < argc; ++i) { + if (!qstrcmp(argv[i], "-g")) + QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); + else if (!qstrcmp(argv[i], "-s")) + QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + else if (!qstrcmp(argv[i], "-d")) + QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); + } + QApplication app(argc, argv); Widget w; -- cgit v1.2.3