Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DeferredShading_qt.cc
Go to the documentation of this file.
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
5 * www.openflipper.org *
6 * *
7 *--------------------------------------------------------------------------- *
8 * This file is part of OpenFlipper. *
9 * *
10 * OpenFlipper is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenFlipper is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenFlipper. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36 * *
37 * $Revision: 18127 $ *
38 * $LastChangedBy: moebius $ *
39 * $Date: 2014-02-05 10:12:54 +0100 (Wed, 05 Feb 2014) $ *
40 * *
41 \*===========================================================================*/
42 
49 #include "DeferredShading.hh"
50 
51 #include <QGLFormat>
52 #include <QAction>
53 #include <QMenu>
54 
55 
56 QString DeferredShading::checkOpenGL() {
57  // Get version and check
58  QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
59  if ( !flags.testFlag(QGLFormat::OpenGL_Version_3_2) )
60  return QString("Insufficient OpenGL Version! OpenGL 3.2 or higher required");
61 
62  // Check extensions
63  QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
64  QString missing("");
65  if ( !glExtensions.contains("GL_ARB_vertex_buffer_object") )
66  missing += "GL_ARB_vertex_buffer_object extension missing\n";
67 
68 #ifndef __APPLE__
69  if ( !glExtensions.contains("GL_ARB_vertex_program") )
70  missing += "GL_ARB_vertex_program extension missing\n";
71 #endif
72 
73  return missing;
74 }
75 
77 // QAction * action = new QAction("DeferredShading Renderer Options" , this );
78 //
79 // connect(action,SIGNAL(triggered( )),this,SLOT(reloadShaders( )));
80 //
81 // return action;
82 
83  QMenu* menu = new QMenu("DeferredShading Renderer Options");
84 
85  // Recreate actionGroup
86  QActionGroup* modeGroup = new QActionGroup( this );
87  modeGroup->setExclusive( true );
88 
89  QAction * action = new QAction("0x MSAA" , modeGroup );
90  action->setCheckable( true );
91  action->setChecked(true);
92 
93  action = new QAction("2x MSAA" , modeGroup );
94  action->setCheckable( true );
95 
96  action = new QAction("4x MSAA" , modeGroup );
97  action->setCheckable( true );
98 
99  action = new QAction("8x MSAA" , modeGroup );
100  action->setCheckable( true );
101 
102 
103  menu->addActions(modeGroup->actions());
104 
105  connect(modeGroup,SIGNAL(triggered( QAction * )),this,SLOT(slotMSAASelection( QAction * )));
106 
107  return menu->menuAction();
108 }
QAction * optionsAction()
Return options menu.