Merge branch 'master' of https://github.com/prusa3d/Slic3r into 3mf_io

This commit is contained in:
Enrico Turri 2018-02-23 08:55:39 +01:00
commit 52c1395626
2 changed files with 11 additions and 20 deletions

View file

@ -1172,6 +1172,7 @@ sub Render {
glLightfv_p(GL_LIGHT1, GL_POSITION, 1, 0, 1, 0); glLightfv_p(GL_LIGHT1, GL_POSITION, 1, 0, 1, 0);
if ($self->enable_picking) { if ($self->enable_picking) {
if (my $pos = $self->_mouse_pos) {
# Render the object for picking. # Render the object for picking.
# FIXME This cannot possibly work in a multi-sampled context as the color gets mangled by the anti-aliasing. # FIXME This cannot possibly work in a multi-sampled context as the color gets mangled by the anti-aliasing.
# Better to use software ray-casting on a bounding-box hierarchy. # Better to use software ray-casting on a bounding-box hierarchy.
@ -1180,10 +1181,8 @@ sub Render {
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_BLEND); glDisable(GL_BLEND);
$self->draw_volumes(1); $self->draw_volumes(1);
glPopAttrib();
glFlush(); glFlush();
glFinish();
if (my $pos = $self->_mouse_pos) {
my $col = [ glReadPixels_p($pos->x, $self->GetSize->GetHeight - $pos->y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE) ]; my $col = [ glReadPixels_p($pos->x, $self->GetSize->GetHeight - $pos->y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE) ];
my $volume_idx = $col->[0] + $col->[1]*256 + $col->[2]*256*256; my $volume_idx = $col->[0] + $col->[1]*256 + $col->[2]*256*256;
$self->_hover_volume_idx(undef); $self->_hover_volume_idx(undef);
@ -1199,11 +1198,8 @@ sub Render {
$self->on_hover->($volume_idx) if $self->on_hover; $self->on_hover->($volume_idx) if $self->on_hover;
} }
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glFlush(); }
glFinish();
glPopAttrib();
} }
# draw fixed background # draw fixed background
@ -1337,9 +1333,6 @@ sub Render {
$self->draw_active_object_annotations; $self->draw_active_object_annotations;
$self->SwapBuffers(); $self->SwapBuffers();
# Calling glFinish has a performance penalty, but it seems to fix some OpenGL driver hang-up with extremely large scenes.
# glFinish();
} }
sub draw_volumes { sub draw_volumes {

View file

@ -338,7 +338,6 @@ sub Render {
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
if (!$self->GetParent->enabled || !$self->layers) { if (!$self->GetParent->enabled || !$self->layers) {
glFlush();
$self->SwapBuffers; $self->SwapBuffers;
return; return;
} }
@ -486,7 +485,6 @@ sub Render {
} }
gluDeleteTess($tess) if $tess; gluDeleteTess($tess) if $tess;
glFlush();
$self->SwapBuffers; $self->SwapBuffers;
} }