Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenFlipper
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
e9025b0a
Commit
e9025b0a
authored
Jun 11, 2018
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commited modifications to OpenGLContext checking, as performed by
Kschuster
parent
5d94be6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
+31
-5
OpenFlipper.cc
OpenFlipper.cc
+31
-5
No files found.
OpenFlipper.cc
View file @
e9025b0a
...
...
@@ -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
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