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
einsteinathome
pulsatingscience
Commits
7947d743
Commit
7947d743
authored
Sep 09, 2011
by
Oliver Bock
Browse files
Show pulsar as wireframe model (without texture)
parent
b5c71b20
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
7947d743
...
...
@@ -63,7 +63,6 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_quadricPulsarMagneticAxis
=
NULL
;
// initialize texture pointers
m_pulsarTexture
=
0
;
m_backgroundTexture
=
0
;
// initial render timing settings
...
...
@@ -115,7 +114,6 @@ PulsarAnimationWidget::~PulsarAnimationWidget()
if
(
m_quadricPulsarSpinAxis
)
gluDeleteQuadric
(
m_quadricPulsarSpinAxis
);
if
(
m_quadricPulsarMagneticAxis
)
gluDeleteQuadric
(
m_quadricPulsarMagneticAxis
);
if
(
m_pulsarTexture
)
deleteTexture
(
m_pulsarTexture
);
if
(
m_backgroundTexture
)
deleteTexture
(
m_backgroundTexture
);
}
...
...
@@ -177,24 +175,6 @@ void PulsarAnimationWidget::initializeGL()
QString
msgPower
=
tr
(
"%1 texture dimensions not a power of 2!"
);
QString
msgSize
=
tr
(
"Maximum texture size exceeded! Scaling down %1 texture to %2x%3..."
);
// prepare and check pulsar texture
QImage
pulsarTexture
(
":/textures/resources/texture_pulsar.png"
);
if
(
pulsarTexture
.
width
()
!=
pulsarTexture
.
height
())
{
qWarning
()
<<
msgShape
.
arg
(
tr
(
"Pulsar"
));
}
else
{
double
integer
=
0.0
;
double
fraction
=
0.0
;
fraction
=
modf
(
log
(
pulsarTexture
.
width
())
/
log
(
2.0
),
&
integer
);
if
(
fraction
>
0.0
)
{
qWarning
()
<<
msgPower
.
arg
(
tr
(
"Pulsar"
));
}
}
if
(
pulsarTexture
.
width
()
>
maxTextureSize
)
{
qWarning
()
<<
msgSize
.
arg
(
tr
(
"pulsar"
).
arg
(
maxTextureSize
).
arg
(
maxTextureSize
));
pulsarTexture
=
pulsarTexture
.
scaled
(
maxTextureSize
,
maxTextureSize
,
Qt
::
IgnoreAspectRatio
,
Qt
::
SmoothTransformation
);
}
// prepare and check background texture
QImage
backgroundTexture
(
":/textures/resources/texture_background_carina.png"
);
if
(
backgroundTexture
.
width
()
!=
backgroundTexture
.
height
())
{
...
...
@@ -214,7 +194,6 @@ void PulsarAnimationWidget::initializeGL()
}
// bind textures
m_pulsarTexture
=
bindTexture
(
pulsarTexture
,
GL_TEXTURE_2D
,
GL_RGBA
);
m_backgroundTexture
=
bindTexture
(
backgroundTexture
,
GL_TEXTURE_2D
,
GL_RGBA
);
// use mipmapped textures
...
...
@@ -284,33 +263,27 @@ void PulsarAnimationWidget::paintGL()
{
glRotatef
(
m_pulsarSpinAxisInclination
,
0.0
,
0.0
,
1.0
);
glRotatef
(
m_pulsarRotationAngle
,
0.0
,
1.0
,
0.0
);
glRotatef
(
90
,
0.0
,
0.0
,
0.0
);
// draw spin axis
if
(
m_showRotationAxes
)
{
glPushMatrix
();
{
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT_AND_DIFFUSE
,
translucent
);
glRotatef
(
90.0
,
1.0
,
0.0
,
0.0
);
glTranslatef
(
0.0
,
0.0
,
-
5.0
);
gluCylinder
(
m_quadricPulsarSpinAxis
,
0.05
,
0.05
,
10.0
,
32
,
1
);
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT
,
no_mat
);
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
mat_diffuse
);
}
glPopMatrix
();
}
// create texture coordinates and enable texturing
glEnable
(
GL_TEXTURE_GEN_S
);
glEnable
(
GL_TEXTURE_GEN_T
);
glBindTexture
(
GL_TEXTURE_2D
,
m_pulsarTexture
);
glEnable
(
GL_TEXTURE_2D
);
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT
,
no_mat
);
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
mat_diffuse
);
// enable wireframe mode
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
// draw pulsar
gluSphere
(
m_quadricPulsar
,
1.0
,
32
,
32
);
// disable texturing
glDisable
(
GL_TEXTURE_GEN_S
);
glDisable
(
GL_TEXTURE_GEN_T
);
glDisable
(
GL_TEXTURE_2D
);
// disable wireframe mode
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
}
glPopMatrix
();
...
...
src/pulsaranimationwidget.h
View file @
7947d743
...
...
@@ -89,7 +89,6 @@ private:
GLUquadricObj
*
m_quadricPulsarSpinAxis
;
GLUquadricObj
*
m_quadricPulsarMagneticAxis
;
GLuint
m_pulsarTexture
;
GLuint
m_backgroundTexture
;
int
m_framesPerSecond
;
...
...
src/pulsatingscience.qrc
View file @
7947d743
<RCC>
<qresource prefix="icons" >
<file>resources/control-pause.png</file>
<file>resources/control-quit.png</file>
<file>resources/control-run.png</file>
<file>resources/control-stop.png</file>
<file>resources/help-about.png</file>
<file>resources/help-help.png</file>
<file>resources/help-website.png</file>
<file>resources/aei-icon48.png</file>
</qresource>
<qresource prefix="i18ns" >
<file>resources/pulsatingscience_de.qm</file>
</qresource>
<qresource prefix="textures" >
<file>resources/texture_background_carina.png</file>
<file>resources/texture_pulsar.png</file>
</qresource>
<qresource prefix="/icons">
<file>resources/control-pause.png</file>
<file>resources/control-quit.png</file>
<file>resources/control-run.png</file>
<file>resources/control-stop.png</file>
<file>resources/help-about.png</file>
<file>resources/help-help.png</file>
<file>resources/help-website.png</file>
<file>resources/aei-icon48.png</file>
</qresource>
<qresource prefix="/i18ns">
<file>resources/pulsatingscience_de.qm</file>
</qresource>
<qresource prefix="/textures">
<file>resources/texture_background_carina.png</file>
</qresource>
</RCC>
src/resources/texture_pulsar.png
deleted
100644 → 0
View file @
b5c71b20
279 KB
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