-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (35 loc) · 1.35 KB
/
main.cpp
File metadata and controls
45 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <mainwindow.h>
#include <QApplication>
#include <QSurfaceFormat>
#include <QDebug>
void debugFormatVersion()
{
QSurfaceFormat form = QSurfaceFormat::defaultFormat();
QSurfaceFormat::OpenGLContextProfile prof = form.profile();
const char *profile =
prof == QSurfaceFormat::CoreProfile ? "Core" :
prof == QSurfaceFormat::CompatibilityProfile ? "Compatibility" :
"None";
printf("Requested format:\n");
printf(" Version: %d.%d\n", form.majorVersion(), form.minorVersion());
printf(" Profile: %s\n", profile);
}
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
// Set OpenGL 3.2 and, optionally, 4-sample multisampling
QSurfaceFormat format;
format.setVersion(3, 2);
format.setOption(QSurfaceFormat::DeprecatedFunctions, false);
format.setProfile(QSurfaceFormat::CoreProfile);
//format.setSamples(4); // Uncomment for nice antialiasing. Not always supported.
/*** AUTOMATIC TESTING: DO NOT MODIFY ***/
/*** Check whether automatic testing is enabled */
/***/ if (qgetenv("CIS277_AUTOTESTING") != nullptr) format.setSamples(0);
QSurfaceFormat::setDefaultFormat(format);
debugFormatVersion();
MainWindow w;
w.show();
return a.exec();
}