Skip to content
GitLab
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
a044df05
Commit
a044df05
authored
Jun 12, 2018
by
Jan Möbius
Browse files
Merge branch 'fixCompatProfileIntelLinux' into 'master'
Fix compat profile intel linux Closes #20 See merge request
!112
parents
7c19d075
d582c099
Changes
1
Hide whitespace changes
Inline
Side-by-side
OpenFlipper.cc
View file @
a044df05
...
...
@@ -516,12 +516,33 @@ bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultin
// 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)
// Example: OpenGL Version 4.6 -> 46
auto
reqVersionInt
=
format
.
version
().
first
*
10
+
format
.
version
().
second
;
auto
curVersionInt
=
curVersion
.
first
*
10
+
curVersion
.
second
;
// Qt Docs say: Whenever "NoProfile" is returned, either the GL version is < 3.2 or (GL >= 3.2) it is actually a core profile
// Thus we set the following guidelines:
// 1. Whenever the actually received GL version is < than the requested one, the context is not the one requested
// 2. If the requested version is >= 3.2 and Compat, only Compat is allowed (as NoProfile is considered core)
// 3. If the requested version is >= 3.2 and Core or NoProfile is requested, Compat is not allowed
// For >= 3.2, treat Core and NoProfile equally
bool
reqCoreOrNoProfile
=
format
.
profile
()
==
QSurfaceFormat
::
NoProfile
||
format
.
profile
()
==
QSurfaceFormat
::
CoreProfile
;
bool
curCoreOrNoProfile
=
resultFormat
.
profile
()
==
QSurfaceFormat
::
NoProfile
||
resultFormat
.
profile
()
==
QSurfaceFormat
::
CoreProfile
;
if
(
curVersionInt
<
32
&&
resultFormat
.
profile
()
==
QSurfaceFormat
::
CoreProfile
)
{
std
::
cerr
<<
"Warning: Got an OpenGL core context with OpengGL version < 3.2 ("
<<
curVersion
.
first
<<
"."
<<
curVersion
.
second
<<
")! This should not be possible."
<<
std
::
endl
;
return
false
;
}
// Check whether the conditions above are met.
// 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
())
if
(
curVersionInt
<
reqVersionInt
||
(
reqVersionInt
>=
32
&&
reqCoreOrNoProfile
!=
curCoreOrNoProfile
))
{
std
::
cout
<<
"[OpenGL context] Requested: "
<<
format
.
version
().
first
<<
"."
<<
format
.
version
().
second
<<
" ("
<<
reqProfileString
<<
")"
...
...
@@ -533,6 +554,10 @@ bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultin
std
::
cout
<<
"[OpenGL context] Successfully created OpenGL context with version "
<<
curVersion
.
first
<<
"."
<<
curVersion
.
second
<<
" ("
<<
curProfileString
<<
")."
<<
std
::
endl
;
if
(
resultFormat
.
profile
()
==
QSurfaceFormat
::
NoProfile
||
curVersionInt
<
32
)
{
std
::
cout
<<
"[OpenGL context] Note that 'NoProfile' is fine for OpenGL version < 3.2 as core profile was introduced in 3.2"
<<
std
::
endl
;
}
return
true
;
}
...
...
@@ -596,6 +621,7 @@ QSurfaceFormat getContextFormat()
{
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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