-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (40 loc) · 1.53 KB
/
main.cpp
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
/****************************************************************************
basic OpenGL demo modified from http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html
****************************************************************************/
#include <QtGui/QGuiApplication>
#include <iostream>
#include "NGLScene.h"
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
// create an OpenGL format specifier
QSurfaceFormat format;
// set the number of samples for multisampling
// will need to enable glEnable(GL_MULTISAMPLE); once we have a context
format.setSamples(4);
#if defined(__APPLE__)
// at present mac osx Mountain Lion only supports GL3.2
// the new mavericks will have GL 4.x so can change
format.setMajorVersion(4);
format.setMinorVersion(1);
#else
// with luck we have the latest GL version so set to this
format.setMajorVersion(4);
format.setMinorVersion(3);
#endif
// now we are going to set to CoreProfile OpenGL so we can't use and old Immediate mode GL
format.setProfile(QSurfaceFormat::CoreProfile);
// now set the depth buffer to 24 bits
format.setDepthBufferSize(24);
// now we are going to create our scene window
NGLScene window;
// and set the OpenGL format
window.setFormat(format);
// we can now query the version to see if it worked
std::cout<<"Profile is "<<format.majorVersion()<<" "<<format.minorVersion()<<"\n";
// set the window size Original: 1024 * 720
window.resize(720, 1280);
// and finally show
window.show();
return app.exec();
}