Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
e0014fce
Commit
e0014fce
authored
May 16, 2018
by
schultz
Browse files
Merge branch 'master' into fixCMakeFinders
parents
cdc925a2
64ef6e27
Changes
13
Hide whitespace changes
Inline
Side-by-side
Core/PluginLoader.cc
View file @
e0014fce
...
...
@@ -887,7 +887,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
}
emit
log
(
LOGOUT
,
tr
(
"Plugin Desciption :
\t
%1 "
).
arg
(
basePlugin
->
description
())
);
emit
log
(
LOGOUT
,
tr
(
"Plugin Desc
r
iption :
\t
%1 "
).
arg
(
basePlugin
->
description
())
);
supported
=
"BaseInterface "
;
...
...
CoreApp/CMakeLists.txt
View file @
e0014fce
...
...
@@ -144,6 +144,7 @@ if (WIN32)
-DUSEACG
-DPLUGINLIBDLL
-DUSEPLUGINLIBDLL
-DFREEGLUT_LIB_PRAGMAS=0
)
endif
()
...
...
OpenFlipper.cc
View file @
e0014fce
...
...
@@ -458,6 +458,164 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
return
CommandLineOk
;
}
namespace
{
// Print human-readable GL profile strings
std
::
string
profileToString
(
QSurfaceFormat
::
OpenGLContextProfile
_profile
)
{
if
(
_profile
==
QSurfaceFormat
::
CompatibilityProfile
)
return
"CompatibilityProfile"
;
if
(
_profile
==
QSurfaceFormat
::
CoreProfile
)
return
"CoreProfile"
;
if
(
_profile
==
QSurfaceFormat
::
NoProfile
)
return
"NoProfile"
;
return
"[Unknown]"
;
}
// Check whether a specific context request can be fulfilled
// Can also return the format of the actually created context
bool
verifySpecificContextFormat
(
QSurfaceFormat
format
,
QSurfaceFormat
*
resultingFormat
=
nullptr
)
{
// All created surfaces try to obey the given format
QSurfaceFormat
::
setDefaultFormat
(
format
);
// We need a temporary qApp to create a surface and test the current context
int
tempArgC
=
0
;
QApplication
tempApp
(
tempArgC
,
nullptr
);
QOffscreenSurface
*
surface
=
new
QOffscreenSurface
();
surface
->
create
();
auto
shareContext
=
QOpenGLContext
::
globalShareContext
();
if
(
!
shareContext
)
{
std
::
cerr
<<
"Error: Apparently no GL context was created!"
<<
std
::
endl
;
return
false
;
}
// Make the globally shared OpenGLContext current
shareContext
->
makeCurrent
(
surface
);
// The opengl surface properties that have actually been applied
// (does not necessarily match the requested properties)
auto
resultFormat
=
QOpenGLContext
::
globalShareContext
()
->
format
();
// Return the format of the actually created context (may be identical to the requested one)
if
(
resultingFormat
!=
nullptr
)
*
resultingFormat
=
resultFormat
;
auto
curVersion
=
resultFormat
.
version
();
// Human-readable name of requested profile
auto
reqProfileString
=
profileToString
(
format
.
profile
());
// Human-readable name of current profile
auto
curProfileString
=
profileToString
(
resultFormat
.
profile
());
// Check whether the actually applied OpenGL context profile matches the requested one
// and the current GL version is at least the requested one (but may be higher)
// If not, print some error to the console
if
(
curVersion
.
first
<
format
.
version
().
first
||
((
curVersion
.
first
==
format
.
version
().
first
)
&&
(
curVersion
.
second
<
format
.
version
().
second
))
||
format
.
profile
()
!=
resultFormat
.
profile
())
{
std
::
cout
<<
"[OpenGL context] Requested: "
<<
format
.
version
().
first
<<
"."
<<
format
.
version
().
second
<<
" ("
<<
reqProfileString
<<
")"
<<
", Actually created: "
<<
curVersion
.
first
<<
"."
<<
curVersion
.
second
<<
" ("
<<
curProfileString
<<
")"
<<
std
::
endl
;
return
false
;
}
std
::
cout
<<
"[OpenGL context] Successfully created OpenGL context with version "
<<
curVersion
.
first
<<
"."
<<
curVersion
.
second
<<
" ("
<<
curProfileString
<<
")."
<<
std
::
endl
;
return
true
;
}
// Create a QSurfaceFormat from the most important properties like version and profile
QSurfaceFormat
createFormat
(
QSurfaceFormat
::
OpenGLContextProfile
_profile
,
int
_glMajor
,
int
_glMinor
,
int
_multisamplingSamples
,
bool
_stereo
,
bool
_debugContext
)
{
QSurfaceFormat
format
;
format
.
setVersion
(
_glMajor
,
_glMinor
);
format
.
setProfile
(
_profile
);
format
.
setSamples
(
_multisamplingSamples
);
format
.
setStereo
(
_stereo
);
if
(
_profile
!=
QSurfaceFormat
::
CoreProfile
)
format
.
setOption
(
QSurfaceFormat
::
DeprecatedFunctions
);
if
(
_debugContext
)
format
.
setOption
(
format
.
options
()
|
QSurfaceFormat
::
DebugContext
);
return
format
;
}
// This method tries to find the best possible OpenGL context format in the following order:
// 1. The profile/format requested via the settings
// 2. A 4.4 compatibility context (should contain all relevant GL functions)
// 3. A 3.2 core context (best choice e.g. on MacOS)
// 4. Return whatever context was applied instead of the requested ones
QSurfaceFormat
getContextFormat
()
{
auto
reqProfile
=
OpenFlipper
::
Options
::
coreProfile
()
?
QSurfaceFormat
::
CoreProfile
:
QSurfaceFormat
::
CompatibilityProfile
;
QPair
<
int
,
int
>
reqVersion
=
OpenFlipper
::
Options
::
glVersion
();
auto
reqSamples
=
OpenFlipper
::
Options
::
samples
();
auto
reqStereo
=
OpenFlipper
::
Options
::
glStereo
();
bool
debugContext
=
OpenFlipper
::
Options
::
debug
();
/*
// Debug: test all (possible and impossible) OpenGL versions and profiles and exit
for(int majo = 1; majo < 5; ++majo)
for(int mino = 0; mino < 10; ++mino)
{
std::cout << "========== " << majo << "." << mino << " ==========="<<std::endl;
verifySpecificContextFormat(createFormat(QSurfaceFormat::CoreProfile, majo, mino, reqSamples, reqStereo, debugContext));
verifySpecificContextFormat(createFormat(QSurfaceFormat::CompatibilityProfile, majo, mino, reqSamples, reqStereo, debugContext));
verifySpecificContextFormat(createFormat(QSurfaceFormat::NoProfile, majo, mino, reqSamples, reqStereo, debugContext));
std::cout << "================================" << std::endl;
std::cout << std::endl;
}
exit(0);
*/
QSurfaceFormat
resultFormat
;
std
::
cout
<<
"[OpenGL context] Trying to create a "
<<
reqVersion
.
first
<<
"."
<<
reqVersion
.
second
<<
" "
<<
profileToString
(
reqProfile
)
<<
" context (default from settings)..."
<<
std
::
endl
;
bool
success
=
verifySpecificContextFormat
(
createFormat
(
reqProfile
,
reqVersion
.
first
,
reqVersion
.
second
,
reqSamples
,
reqStereo
,
debugContext
),
&
resultFormat
);
// If that did not work...
if
(
!
success
)
{
std
::
cout
<<
"[OpenGL context] Trying to create a 4.4 compat context..."
<<
std
::
endl
;
success
=
verifySpecificContextFormat
(
createFormat
(
QSurfaceFormat
::
CompatibilityProfile
,
4
,
4
,
reqSamples
,
reqStereo
,
debugContext
),
&
resultFormat
);
if
(
!
success
)
{
std
::
cout
<<
"[OpenGL context] Trying to create a 3.2 core context..."
<<
std
::
endl
;
success
=
verifySpecificContextFormat
(
createFormat
(
QSurfaceFormat
::
CoreProfile
,
3
,
2
,
reqSamples
,
reqStereo
,
debugContext
),
&
resultFormat
);
if
(
!
success
)
{
std
::
cerr
<<
"[OpenGL context] Warning: Could not create any of the requested GL contexts."
<<
std
::
endl
;
std
::
cerr
<<
"[OpenGL context] The following context (proposed by the graphics driver) will be created:"
<<
std
::
endl
;
std
::
cerr
<<
"[OpenGL context] Profile: "
<<
profileToString
(
resultFormat
.
profile
())
<<
", Version: "
<<
resultFormat
.
version
().
first
<<
"."
<<
resultFormat
.
version
().
second
<<
std
::
endl
;
std
::
cerr
<<
"[OpenGL context] Please consider setting a supported OpenGL version and profile in the Options dialog."
<<
std
::
endl
;
}
}
}
return
resultFormat
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -533,70 +691,30 @@ int main(int argc, char **argv)
QApplication
::
setAttribute
(
Qt
::
AA_ShareOpenGLContexts
);
QApplication
::
setColorSpec
(
QApplication
::
CustomColor
);
// Try creating a valid OpenGL context
/******************************/
QSurfaceFormat
format
;
QPair
<
int
,
int
>
version
=
OpenFlipper
::
Options
::
glVersion
();
format
.
setVersion
(
version
.
first
,
version
.
second
);
if
(
OpenFlipper
::
Options
::
coreProfile
())
{
format
.
setProfile
(
QSurfaceFormat
::
CoreProfile
);
}
else
{
format
.
setProfile
(
QSurfaceFormat
::
CompatibilityProfile
);
format
.
setOption
(
QSurfaceFormat
::
DeprecatedFunctions
);
}
if
(
OpenFlipper
::
Options
::
debug
())
format
.
setOption
(
format
.
options
()
|
QSurfaceFormat
::
DebugContext
);
format
.
setSamples
(
OpenFlipper
::
Options
::
samples
());
format
.
setStereo
(
OpenFlipper
::
Options
::
glStereo
());
// Get a valid context format
QSurfaceFormat
resultFormat
=
getContextFormat
();
QSurfaceFormat
::
setDefaultFormat
(
format
);
// Set temporary(!) OpenGL settings
OpenFlipper
::
Options
::
samples
(
resultFormat
.
samples
(),
true
);
OpenFlipper
::
Options
::
glStereo
(
resultFormat
.
stereo
(),
true
);
OpenFlipper
::
Options
::
glVersion
(
resultFormat
.
version
(),
true
);
OpenFlipper
::
Options
::
coreProfile
(
resultFormat
.
profile
()
==
QSurfaceFormat
::
CoreProfile
,
true
);
// Create the actual context
QSurfaceFormat
::
setDefaultFormat
(
resultFormat
);
QApplication
app
(
argc
,
argv
);
QScreen
*
screen
=
app
.
primaryScreen
();
QOffscreenSurface
*
surface
=
new
QOffscreenSurface
();
surface
->
create
();
//
m
ake the globally shared OpenGLContext current
//
M
ake the globally shared OpenGLContext current
QOpenGLContext
::
globalShareContext
()
->
makeCurrent
(
surface
);
/******************************/
// The opengl surface properties that have actually been applied
// (does not necessarily match the requested properties)
QSurfaceFormat
actuallyAppliedFormat
=
QOpenGLContext
::
globalShareContext
()
->
format
();
auto
curVersion
=
actuallyAppliedFormat
.
version
();
// Check whether the actually applied OpenGL context matches the requested one.
// If not, print some error to the console
if
(
curVersion
.
first
!=
version
.
first
||
curVersion
.
second
!=
version
.
second
||
format
.
profile
()
!=
actuallyAppliedFormat
.
profile
())
{
auto
reqProfileString
=
"None"
;
if
(
format
.
profile
()
==
QSurfaceFormat
::
CoreProfile
)
reqProfileString
=
"Core"
;
else
if
(
format
.
profile
()
==
QSurfaceFormat
::
CompatibilityProfile
)
reqProfileString
=
"Compat"
;
auto
curProfileString
=
"None"
;
if
(
actuallyAppliedFormat
.
profile
()
==
QSurfaceFormat
::
CoreProfile
)
curProfileString
=
"Core"
;
else
if
(
actuallyAppliedFormat
.
profile
()
==
QSurfaceFormat
::
CompatibilityProfile
)
curProfileString
=
"Compat"
;
std
::
cerr
<<
"Warning! OpenGL version "
<<
version
.
first
<<
"."
<<
version
.
second
<<
" ("
<<
reqProfileString
<<
")"
<<
" was requested, but version "
<<
curVersion
.
first
<<
"."
<<
curVersion
.
second
<<
" ("
<<
curProfileString
<<
")"
<<
" was applied."
<<
std
::
endl
;
std
::
cerr
<<
"Please consider setting supported OpenGL version and context in the Options dialog."
<<
std
::
endl
;
}
// Check whether there is OpenGL support. If not, return.
if
(
!
QGLFormat
::
hasOpenGL
()
)
{
std
::
cerr
<<
"This system has no OpenGL support.
\n
"
;
return
-
1
;
...
...
PluginLib/CMakeLists.txt
View file @
e0014fce
...
...
@@ -63,6 +63,7 @@ if (WIN32)
-DPLUGINLIBDLL
-DACGDLL
-DUSEACG
-DFREEGLUT_LIB_PRAGMAS=0
)
endif
()
...
...
cmake/CMakeLists.txt
View file @
e0014fce
...
...
@@ -20,9 +20,9 @@ set( CMAKE_CXX_STANDARD 11 )
# ACG Environment default settings
# This is ugly but currently we need to work around the default installed 5.3 on debian
if
(
EXISTS /ACG/acgdev/gcc-x86_64/qt-5.
9.0/5.9
/gcc_64/
)
if
(
EXISTS /ACG/acgdev/gcc-x86_64/qt-5.
10.1/5.10.1
/gcc_64/
)
# Default to this install path for QT%_INSTALL_DIR
set
(
QT5_INSTALL_PATH /ACG/acgdev/gcc-x86_64/qt-5.
9.0/5.9
/gcc_64/ CACHE PATH
"Qt5 install path set for ACG environment"
)
set
(
QT5_INSTALL_PATH /ACG/acgdev/gcc-x86_64/qt-5.
10.1/5.10.1
/gcc_64/ CACHE PATH
"Qt5 install path set for ACG environment"
)
endif
()
if
(
WIN32
)
...
...
cmake/FindEIGEN3.cmake
View file @
e0014fce
...
...
@@ -37,6 +37,7 @@ find_path( EIGEN3_INCLUDE_DIR
/usr/local/include
/usr/local/include/eigen3/
/opt/local/include/eigen3/
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/Eigen-3.3.4"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/Eigen-3.2.8"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/Eigen-3.2.6"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/Eigen-3.2.6"
...
...
cmake/FindQwt6.cmake
View file @
e0014fce
...
...
@@ -34,13 +34,15 @@ endif()
if
(
QT5_FOUND
)
if
(
${
Qt5Core_VERSION_STRING
}
VERSION_EQUAL
"5.10.1"
)
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-x86_64/qwt-6.1.3-qt5.10.1"
)
elseif
(
${
Qt5Core_VERSION_STRING
}
VERSION_EQUAL
"5.9.0"
)
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-x86_64/qwt-6.1.3-qt5.9.0"
)
else
()
if
(
${
Qt5Core_VERSION_STRING
}
VERSION_EQUAL
"5.8.0"
OR
${
Qt5Core_VERSION_STRING
}
VERSION_GREATER
"5.5.1"
)
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-x86_64/qwt-6.1.3-qt5.8.0"
)
else
()
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-4.9-x86_64/qwt-6.1-qt5"
)
else
()
if
(
${
Qt5Core_VERSION_STRING
}
VERSION_EQUAL
"5.9.0"
)
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-x86_64/qwt-6.1.3-qt5.9.0"
)
else
()
if
(
${
Qt5Core_VERSION_STRING
}
VERSION_EQUAL
"5.8.0"
OR
${
Qt5Core_VERSION_STRING
}
VERSION_GREATER
"5.5.1"
)
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-x86_64/qwt-6.1.3-qt5.8.0"
)
else
()
SET
(
ACG_SEARCH_PATH
"/ACG/acgdev/gcc-4.9-x86_64/qwt-6.1-qt5"
)
endif
()
endif
()
endif
()
else
()
...
...
cmake/plugin.cmake
View file @
e0014fce
...
...
@@ -695,7 +695,7 @@ function (_build_openflipper_plugin plugin)
# Visual studio requires our plugins to link with GLUT
find_package
(
GLUT
)
# generate dllinport defines
add_definitions
(
-DACGDLL -DUSEACG -DPLUGINLIBDLL -DUSEPLUGINLIBDLL
)
add_definitions
(
-DACGDLL -DUSEACG -DPLUGINLIBDLL -DUSEPLUGINLIBDLL
-DFREEGLUT_LIB_PRAGMAS=0
)
target_link_libraries
(
Plugin-
${
plugin
}
${
OPENMESH_LIBRARIES
}
ACG
...
...
cmake/type.cmake
View file @
e0014fce
...
...
@@ -29,6 +29,7 @@ if (WIN32)
-DBUILDOBJECTTYPEDLL
-DACGDLL
-DUSEACG
-DFREEGLUT_LIB_PRAGMAS=0
)
endif
()
...
...
common/glew_wrappers.cc
View file @
e0014fce
...
...
@@ -48,11 +48,14 @@
\*===========================================================================*/
#include "glew_wrappers.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <GL/glew.h>
#include <stdio.h>
DLLEXPORT
void
initGlew
()
{
if
(
OpenFlipper
::
Options
::
glVersion
().
first
>=
3
&&
OpenFlipper
::
Options
::
glVersion
().
second
>=
2
&&
OpenFlipper
::
Options
::
coreProfile
())
glewExperimental
=
GL_TRUE
;
GLenum
err
=
glewInit
();
if
(
GLEW_OK
!=
err
)
{
...
...
libs_required/ACG/CMakeLists.txt
View file @
e0014fce
...
...
@@ -73,7 +73,6 @@ include_directories (
link_directories
(
${
GLEW_LIBRARY_DIR
}
${
GLUT_LIBRARY_DIR
}
)
#===================================================================
...
...
@@ -101,7 +100,7 @@ set (directories
# generate dllexport macros on windows
if
(
WIN32
)
add_definitions
(
-DACGDLL
)
add_definitions
(
-DACGDLL
-DFREEGLUT_LIB_PRAGMAS=0
)
remove_definitions
(
-DUSEACG
)
endif
()
...
...
widgets/glWidget/QtBaseViewer.cc
View file @
e0014fce
...
...
@@ -153,7 +153,7 @@ glViewer::glViewer( QGraphicsScene* _scene,
createWidgets
();
// bind GL context to GL state class
glstate_
=
new
ACG
::
GLState
(
true
,
_glWidget
->
format
().
profile
()
=
=
OFGLFormat
::
Co
mpatibility
Profile
);
glstate_
=
new
ACG
::
GLState
(
true
,
_glWidget
->
format
().
profile
()
!
=
OFGLFormat
::
Co
re
Profile
);
properties_
.
setglState
(
glstate_
);
...
...
widgets/loggerWidget/loggerWidget.cc
View file @
e0014fce
...
...
@@ -129,7 +129,7 @@ LoggerWidget::LoggerWidget( QWidget *parent)
allButton_
=
new
QPushButton
(
QIcon
(
path
+
"status_all.png"
),
tr
(
"All Messages"
));
allButton_
->
setCheckable
(
true
);
allButton_
->
setAutoExclusive
(
true
);
infoButton_
=
new
QPushButton
(
QIcon
(
path
+
"status_green.png"
),
tr
(
"Information
s
"
));
infoButton_
=
new
QPushButton
(
QIcon
(
path
+
"status_green.png"
),
tr
(
"Information"
));
infoButton_
->
setCheckable
(
true
);
infoButton_
->
setAutoExclusive
(
true
);
warnButton_
=
new
QPushButton
(
QIcon
(
path
+
"status_yellow.png"
),
tr
(
"Warnings"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment