Restored correct transparency of the cutting plane

This commit is contained in:
Alessandro Ranellucci 2015-01-07 19:46:37 +01:00
parent b085710a4b
commit 06aaf83cfe

View file

@ -729,9 +729,7 @@ sub Render {
# draw ground and axes # draw ground and axes
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
my $z0 = 0;
{
# draw ground # draw ground
my $ground_z = GROUND_Z; my $ground_z = GROUND_Z;
if ($self->bed_triangles) { if ($self->bed_triangles) {
@ -787,11 +785,17 @@ sub Render {
glEnd(); glEnd();
} }
glEnable(GL_LIGHTING);
# draw objects
$self->draw_volumes;
# draw cutting plane # draw cutting plane
if (defined $self->cutting_plane_z) { if (defined $self->cutting_plane_z) {
my $plane_z = $z0 + $self->cutting_plane_z; my $plane_z = $self->cutting_plane_z;
my $bb = $volumes_bb; my $bb = $volumes_bb;
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -804,12 +808,6 @@ sub Render {
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
}
glEnable(GL_LIGHTING);
# draw objects
$self->draw_volumes;
glFlush(); glFlush();