Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graphicsframework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
graphicsframework
Commits
4236927a
Commit
4236927a
authored
5 years ago
by
Oliver Behnke
Browse files
Options
Downloads
Patches
Plain Diff
Fix up initial window and OpenGL context instantiation (incl. fallback logic)
parent
6b630d24
No related branches found
No related tags found
1 merge request
!1
Move macOS build to 64 bit
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/framework/WindowManager.cpp
+19
-9
19 additions, 9 deletions
src/framework/WindowManager.cpp
with
19 additions
and
9 deletions
src/framework/WindowManager.cpp
+
19
−
9
View file @
4236927a
...
...
@@ -123,7 +123,7 @@ bool WindowManager::initialize(const int width, const int height, const int fram
m_CurrentWidth
=
m_WindowedWidth
;
m_CurrentHeight
=
m_WindowedHeight
;
//
finally, get
window
//
create
window
m_Window
=
SDL_CreateWindow
(
"Einstein@Home"
,
SDL_WINDOWPOS_CENTERED
,
...
...
@@ -135,6 +135,13 @@ bool WindowManager::initialize(const int width, const int height, const int fram
if
(
m_Window
==
NULL
)
{
cerr
<<
"Could not acquire rendering surface ("
<<
SDL_GetError
()
<<
"): will try fallback..."
<<
endl
;
}
else
{
// create OpenGL context
m_GLContext
=
SDL_GL_CreateContext
(
m_Window
);
if
(
m_GLContext
==
NULL
)
{
cerr
<<
"Could not acquire OpenGL context ("
<<
SDL_GetError
()
<<
"): will try fallback..."
<<
endl
;
}
}
// check if we got acceleration
int
accelerated
=
0
;
...
...
@@ -142,7 +149,8 @@ bool WindowManager::initialize(const int width, const int height, const int fram
cerr
<<
"Could not ensure accelerated rendering surface. Assuming no acceleration..."
<<
endl
;
}
if
(
m_Window
==
NULL
||
!
accelerated
)
{
// handle fallback
if
(
m_Window
==
NULL
||
m_GLContext
==
NULL
||
!
accelerated
)
{
cerr
<<
"Disabling high quality features..."
<<
endl
;
// disable features that demand acceleration
...
...
@@ -153,6 +161,7 @@ bool WindowManager::initialize(const int width, const int height, const int fram
// note, requires to extend starsphere's constructor (uses its own BOINCClientAdapter!)
// reset window
if
(
m_Window
)
SDL_DestroyWindow
(
m_Window
);
m_Window
=
SDL_CreateWindow
(
"Einstein@Home"
,
SDL_WINDOWPOS_CENTERED
,
...
...
@@ -165,13 +174,14 @@ bool WindowManager::initialize(const int width, const int height, const int fram
cerr
<<
"Could not acquire window ("
<<
SDL_GetError
()
<<
"): giving up!"
<<
endl
;
return
false
;
}
}
// finally create OpenGL context
else
{
// create OpenGL context
m_GLContext
=
SDL_GL_CreateContext
(
m_Window
);
if
(
m_GLContext
==
NULL
)
{
cerr
<<
"Could not acquire OpenGL context ("
<<
SDL_GetError
()
<<
"): giving up!"
<<
endl
;
return
false
;
SDL_DestroyWindow
(
m_Window
);
}
}
}
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment