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
f6b94c1a
Commit
f6b94c1a
authored
May 08, 2018
by
Jan Möbius
Browse files
Merge branch 'check_glcontext_on_startup' into 'master'
Check glcontext on startup See merge request
!94
parents
adca7cc8
9e50d907
Changes
1
Show whitespace changes
Inline
Side-by-side
OpenFlipper.cc
View file @
f6b94c1a
...
...
@@ -565,6 +565,38 @@ int main(int argc, char **argv)
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
;
}
if
(
!
QGLFormat
::
hasOpenGL
()
)
{
std
::
cerr
<<
"This system has no OpenGL support.
\n
"
;
return
-
1
;
...
...
Write
Preview
Supports
Markdown
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