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
96ea06bd
Commit
96ea06bd
authored
Dec 03, 2008
by
Oliver Bock
Browse files
Objects have to be rendered in the right order for alpha blending to work
parent
401554dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
96ea06bd
...
...
@@ -73,11 +73,12 @@ PulsarAnimationWidget::~PulsarAnimationWidget()
void
PulsarAnimationWidget
::
initializeGL
()
{
glShadeModel
(
GL_SMOOTH
);
glClearColor
(
0.0
,
0.0
,
0.0
,
0.0
);
glClearDepth
(
1.0
f
);
glEnable
(
GL_DEPTH_TEST
);
glDepthFunc
(
GL_LEQUAL
);
glEnable
(
GL_DEPTH_TEST
);
glShadeModel
(
GL_SMOOTH
);
glHint
(
GL_PERSPECTIVE_CORRECTION_HINT
,
GL_NICEST
);
GLfloat
LightAmbient
[]
=
{
0.3
f
,
0.3
f
,
0.3
f
,
1.0
f
};
...
...
@@ -98,8 +99,8 @@ void PulsarAnimationWidget::initializeGL()
glEnable
(
GL_LIGHT0
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
glEnable
(
GL_BLEND
);
m_quadricPulsarOrbitPlane
=
gluNewQuadric
();
m_quadricPulsar
=
gluNewQuadric
();
...
...
@@ -135,19 +136,6 @@ void PulsarAnimationWidget::paintGL()
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
);
if
(
m_cameraInteraction
)
{
static
GLfloat
pulsarOrbitAmbientDiffuse
[]
=
{
1.0
,
1.0
,
1.0
,
0.25
};
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT_AND_DIFFUSE
,
pulsarOrbitAmbientDiffuse
);
glPushMatrix
();
glRotatef
(
90.0
f
,
1.0
f
,
0.0
f
,
0.0
f
);
gluDisk
(
m_quadricPulsarOrbitPlane
,
m_pulsarOrbitRadius
*
0.9
f
,
m_pulsarOrbitRadius
*
1.1
f
,
64
,
1
);
glPopMatrix
();
}
// TODO: should be located elsewhere
static
GLfloat
no_mat
[]
=
{
0.0
,
0.0
,
0.0
,
1.0
};
static
GLfloat
mat_diffuse
[]
=
{
0.5
,
0.5
,
0.5
,
1.0
};
...
...
@@ -198,6 +186,19 @@ void PulsarAnimationWidget::paintGL()
gluCylinder
(
m_quadricPulsarCone2
,
0.5
f
,
0.0
f
,
3.0
f
,
32
,
32
);
glPopMatrix
();
glPopMatrix
();
if
(
m_cameraInteraction
)
{
static
GLfloat
pulsarOrbitAmbientDiffuse
[]
=
{
1.0
,
1.0
,
1.0
,
0.33
};
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT_AND_DIFFUSE
,
pulsarOrbitAmbientDiffuse
);
glPushMatrix
();
glRotatef
(
90.0
f
,
1.0
f
,
0.0
f
,
0.0
f
);
gluDisk
(
m_quadricPulsarOrbitPlane
,
m_pulsarOrbitRadius
*
0.9
f
,
m_pulsarOrbitRadius
*
1.1
f
,
64
,
1
);
glPopMatrix
();
}
}
void
PulsarAnimationWidget
::
runAnimation
()
...
...
Write
Preview
Supports
Markdown
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