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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Oliver Behnke
graphicsframework
Commits
87ecd786
Commit
87ecd786
authored
Apr 7, 2008
by
Oliver Bock
Browse files
Options
Downloads
Patches
Plain Diff
Replaced mockup HUD data with live contents
parent
98f402a9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Starsphere.cpp
+55
-9
55 additions, 9 deletions
Starsphere.cpp
Starsphere.h
+16
-3
16 additions, 3 deletions
Starsphere.h
with
71 additions
and
12 deletions
Starsphere.cpp
+
55
−
9
View file @
87ecd786
...
@@ -593,7 +593,7 @@ void Starsphere::render(const double timeOfDay)
...
@@ -593,7 +593,7 @@ void Starsphere::render(const double timeOfDay)
if
(
isFeature
(
LOGO
)
||
isFeature
(
SEARCHINFO
))
{
if
(
isFeature
(
LOGO
)
||
isFeature
(
SEARCHINFO
))
{
static
const
GLfloat
xStartPosLeft
=
0.008
;
static
const
GLfloat
xStartPosLeft
=
0.008
;
const
GLfloat
xStartPosRight
=
1
*
aspect
-
0.
20
5
;
const
GLfloat
xStartPosRight
=
1
*
aspect
-
0.
14
5
;
static
const
GLfloat
yStartPosTop
=
0.975
;
static
const
GLfloat
yStartPosTop
=
0.975
;
static
const
GLfloat
yStartPosBottom
=
0.07
;
static
const
GLfloat
yStartPosBottom
=
0.07
;
static
const
GLfloat
fontScaleLarge
=
0.0225
;
static
const
GLfloat
fontScaleLarge
=
0.0225
;
...
@@ -647,22 +647,22 @@ void Starsphere::render(const double timeOfDay)
...
@@ -647,22 +647,22 @@ void Starsphere::render(const double timeOfDay)
glColor4f
(
1.0
,
1.0
,
1.0
,
0.5
);
glColor4f
(
1.0
,
1.0
,
1.0
,
0.5
);
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"User: Oliver"
);
m_PolygonFont
->
Render
(
string
(
"User: "
+
m_UserName
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
2
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
2
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Team: Albert-Einstein-Institut"
);
m_PolygonFont
->
Render
(
string
(
"Team: "
+
m_TeamName
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
3
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
3
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Project
c
redit
s
:
12.000"
);
m_PolygonFont
->
Render
(
string
(
"Project
C
redit:
"
+
m_UserCredit
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
4
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosLeft
,
yStartPosBottom
-
4
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Project RAC:
145.00"
);
m_PolygonFont
->
Render
(
string
(
"Project RAC:
"
+
m_UserRACredit
).
c_str
()
);
glPopMatrix
();
glPopMatrix
();
...
@@ -678,22 +678,22 @@ void Starsphere::render(const double timeOfDay)
...
@@ -678,22 +678,22 @@ void Starsphere::render(const double timeOfDay)
glColor4f
(
1.0
,
1.0
,
1.0
,
0.5
);
glColor4f
(
1.0
,
1.0
,
1.0
,
0.5
);
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"
Right
a
scension
: 180.00 deg"
);
m_PolygonFont
->
Render
(
string
(
"Ascension: "
+
m_WUSkyPos
Right
A
scension
+
" deg"
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
2
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
2
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Declination:
45.00 deg"
);
m_PolygonFont
->
Render
(
string
(
"Declination:
"
+
m_WUSkyPosDeclination
+
" deg"
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
3
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
3
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Frequency: 850.05 Hz"
);
m_PolygonFont
->
Render
(
string
(
"Completed: "
+
m_WUPercentDone
+
" %"
).
c_str
()
);
glLoadIdentity
();
glLoadIdentity
();
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
4
*
yOffsetMedium
,
0
);
glTranslatef
(
xStartPosRight
,
yStartPosBottom
-
4
*
yOffsetMedium
,
0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
glScalef
(
fontScaleSmall
,
fontScaleSmall
,
1.0
);
m_PolygonFont
->
Render
(
"Spindown rate: 3.25 * 10^-10 Hz/s"
);
m_PolygonFont
->
Render
(
string
(
"CPU Time: "
+
m_WUCPUTime
).
c_str
()
);
glPopMatrix
();
glPopMatrix
();
}
}
...
@@ -811,3 +811,49 @@ bool Starsphere::isFeature(const int feature)
...
@@ -811,3 +811,49 @@ bool Starsphere::isFeature(const int feature)
{
{
return
((
featureFlags
&
feature
)
==
feature
?
true
:
false
);
return
((
featureFlags
&
feature
)
==
feature
?
true
:
false
);
}
}
void
Starsphere
::
refreshBOINCInformation
()
{
// call base class implementation
AbstractGraphicsEngine
::
refreshBOINCInformation
();
// prepare conversion buffer
stringstream
buffer
;
buffer
.
precision
(
2
);
buffer
.
setf
(
ios
::
fixed
,
ios
::
floatfield
);
// store content required for our HUD
m_UserName
=
boincAdapter
.
userName
();
m_TeamName
=
boincAdapter
.
teamName
();
buffer
<<
fixed
<<
boincAdapter
.
userCredit
();
m_UserCredit
=
buffer
.
str
();
buffer
.
str
(
""
);
buffer
<<
fixed
<<
boincAdapter
.
userRACredit
();
m_UserRACredit
=
buffer
.
str
();
buffer
.
str
(
""
);
buffer
<<
fixed
<<
boincAdapter
.
wuSkyPosRightAscension
()
*
360
/
PI2
;
m_WUSkyPosRightAscension
=
buffer
.
str
();
buffer
.
str
(
""
);
buffer
<<
fixed
<<
boincAdapter
.
wuSkyPosDeclination
()
*
360
/
PI2
;
m_WUSkyPosDeclination
=
buffer
.
str
();
buffer
.
str
(
""
);
buffer
<<
fixed
<<
boincAdapter
.
wuFractionDone
()
*
100
;
m_WUPercentDone
=
buffer
.
str
();
buffer
.
str
(
""
);
double
cputime
=
boincAdapter
.
wuCPUTime
();
int
day
=
cputime
/
86400
;
int
hrs
=
(
cputime
-
day
*
86400
)
/
3600
;
int
min
=
(
cputime
-
(
day
*
86400
+
hrs
*
3600
))
/
60
;
int
sec
=
cputime
-
(
day
*
86400
+
hrs
*
3600
+
min
*
60
);
// TODO: get rid of sprintf ;-)
char
duration
[]
=
"00:00:00:00"
;
sprintf
(
duration
,
"%.2i:%.2i:%.2i:%.2i"
,
day
,
hrs
,
min
,
sec
);
buffer
<<
string
(
duration
);
m_WUCPUTime
=
buffer
.
str
();
}
This diff is collapsed.
Click to expand it.
Starsphere.h
+
16
−
3
View file @
87ecd786
...
@@ -3,8 +3,9 @@
...
@@ -3,8 +3,9 @@
#include
<cmath>
#include
<cmath>
#include
<cstdio>
#include
<cstdio>
#include
<
c
string>
#include
<string>
#include
<iostream>
#include
<iostream>
#include
<sstream>
#include
<SDL.h>
#include
<SDL.h>
#include
<SDL_opengl.h>
#include
<SDL_opengl.h>
...
@@ -12,8 +13,6 @@
...
@@ -12,8 +13,6 @@
#include
"AbstractGraphicsEngine.h"
#include
"AbstractGraphicsEngine.h"
#define EAH_SHMEM_APP_NAME "Einstein@Home"
/* SIN and COS take arguments in DEGREES */
/* SIN and COS take arguments in DEGREES */
#define PI 3.14159265
#define PI 3.14159265
#define PI2 (2*PI)
#define PI2 (2*PI)
...
@@ -46,6 +45,9 @@ public:
...
@@ -46,6 +45,9 @@ public:
void
mouseMoveEvent
(
const
int
deltaX
,
const
int
deltaY
,
const
int
buttonPressed
);
void
mouseMoveEvent
(
const
int
deltaX
,
const
int
deltaY
,
const
int
buttonPressed
);
void
keyboardPressEvent
(
const
int
keyPressed
);
void
keyboardPressEvent
(
const
int
keyPressed
);
// update HUD content
void
refreshBOINCInformation
();
private:
private:
void
make_stars
();
void
make_stars
();
void
make_pulsars
();
void
make_pulsars
();
...
@@ -120,8 +122,19 @@ private:
...
@@ -120,8 +122,19 @@ private:
LOGO
=
512
LOGO
=
512
};
};
// resource handling
const
Resource
*
m_FontResource
;
const
Resource
*
m_FontResource
;
FTFont
*
m_PolygonFont
;
FTFont
*
m_PolygonFont
;
// local HUD contents
string
m_UserName
;
string
m_TeamName
;
string
m_UserCredit
;
string
m_UserRACredit
;
string
m_WUSkyPosRightAscension
;
string
m_WUSkyPosDeclination
;
string
m_WUPercentDone
;
string
m_WUCPUTime
;
};
};
/* Constellation & star coordinates are in starlist.C */
/* Constellation & star coordinates are in starlist.C */
...
...
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