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
2b4a20d6
Commit
2b4a20d6
authored
Jan 23, 2009
by
Oliver Bock
Browse files
Added preliminary texture for pulsar
parent
57281889
Changes
4
Show whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
2b4a20d6
...
...
@@ -105,6 +105,17 @@ void PulsarAnimationWidget::initializeGL()
gluQuadricNormals
(
m_quadricPulsar
,
GLU_SMOOTH
);
gluQuadricNormals
(
m_quadricPulsarCone1
,
GLU_SMOOTH
);
gluQuadricNormals
(
m_quadricPulsarCone2
,
GLU_SMOOTH
);
// load pulsar texture
m_pulsarTexture
=
bindTexture
(
QImage
(
":/textures/resources/texture_pulsar.png"
),
GL_TEXTURE_2D
,
GL_RGBA
);
// use mipmap filter
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR_MIPMAP_NEAREST
);
// enable 2D sphere mapping (s/t coordinates)
glTexGeni
(
GL_S
,
GL_TEXTURE_GEN_MODE
,
GL_SPHERE_MAP
);
glTexGeni
(
GL_T
,
GL_TEXTURE_GEN_MODE
,
GL_SPHERE_MAP
);
}
void
PulsarAnimationWidget
::
resizeGL
(
int
w
,
int
h
)
...
...
@@ -135,7 +146,7 @@ void PulsarAnimationWidget::paintGL()
static
GLfloat
no_mat
[]
=
{
0.0
,
0.0
,
0.0
,
1.0
};
static
GLfloat
mat_diffuse
[]
=
{
0.5
,
0.5
,
0.5
,
1.0
};
static
GLfloat
mat_specular
[]
=
{
1.0
,
1.0
,
1.0
,
1.0
};
static
GLfloat
low_shininess
[]
=
{
5.0
};
static
GLfloat
low_shininess
[]
=
{
2.5
};
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT
,
no_mat
);
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
mat_diffuse
);
...
...
@@ -156,9 +167,21 @@ void PulsarAnimationWidget::paintGL()
cos
(
m_orbitRotationAngle
*
deg2rad
)
*
m_pulsarOrbitRadius
);
glPushMatrix
();
// enable texture coordinates and bind texture
glEnable
(
GL_TEXTURE_2D
);
glEnable
(
GL_TEXTURE_GEN_S
);
glEnable
(
GL_TEXTURE_GEN_T
);
glBindTexture
(
GL_TEXTURE_2D
,
m_pulsarTexture
);
// FIXME: how to rotate texture?
glRotatef
(
m_pulsarRotationAngle
,
0.0
f
,
1.0
f
,
0.0
f
);
glRotatef
(
m_pulsarSpinAxisInclination
,
1.0
f
,
0.0
f
,
0.0
f
);
gluSphere
(
m_quadricPulsar
,
1.0
f
,
32
,
32
);
// disable texture coordinates
glDisable
(
GL_TEXTURE_GEN_S
);
glDisable
(
GL_TEXTURE_GEN_T
);
glDisable
(
GL_TEXTURE_2D
);
glPopMatrix
();
// TODO: should be located elsewhere
...
...
src/pulsaranimationwidget.h
View file @
2b4a20d6
...
...
@@ -71,6 +71,8 @@ protected:
GLUquadricObj
*
m_quadricPulsarCone1
;
GLUquadricObj
*
m_quadricPulsarCone2
;
GLuint
m_pulsarTexture
;
int
m_framesPerSecond
;
float
m_pulsarRotationAngle
;
...
...
src/pulsatingscience.qrc
View file @
2b4a20d6
...
...
@@ -9,4 +9,7 @@
<file>resources/help-website.png</file>
<file>resources/aei-icon48.png</file>
</qresource>
<qresource prefix="textures" >
<file>resources/texture_pulsar.png</file>
</qresource>
</RCC>
src/resources/texture_pulsar.png
0 → 100644
View file @
2b4a20d6
36.5 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