3rd attempt to fix opengl on ubuntu
This commit is contained in:
parent
23d10fdadc
commit
8db4fdc24c
@ -186,7 +186,9 @@ sub new {
|
||||
# Initialize 3D toolpaths preview
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
|
||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
#==================================================================================================================
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
#==================================================================================================================
|
||||
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
|
||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
|
||||
$self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
|
||||
@ -202,21 +204,25 @@ sub new {
|
||||
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
||||
my $preview = $self->{preview_notebook}->GetCurrentPage;
|
||||
if (($preview != $self->{preview3D}) && ($preview != $self->{canvas3D})) {
|
||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
||||
#==================================================================================================================
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
||||
# Slic3r::GUI::_3DScene::reset_current_canvas();
|
||||
#==================================================================================================================
|
||||
$preview->OnActivate if $preview->can('OnActivate');
|
||||
} elsif ($preview == $self->{preview3D}) {
|
||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 1);
|
||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
||||
#==================================================================================================================
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 1);
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 0);
|
||||
#==================================================================================================================
|
||||
$self->{preview3D}->load_print;
|
||||
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
||||
Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
|
||||
} elsif ($preview == $self->{canvas3D}) {
|
||||
Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 1);
|
||||
Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
#==================================================================================================================
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{canvas3D}, 1);
|
||||
# Slic3r::GUI::_3DScene::set_active($self->{preview3D}->canvas, 0);
|
||||
#==================================================================================================================
|
||||
if (Slic3r::GUI::_3DScene::is_reload_delayed($self->{canvas3D})) {
|
||||
my $selections = $self->collect_selections;
|
||||
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
|
||||
|
@ -1764,13 +1764,13 @@ bool _3DScene::init(wxGLCanvas* canvas)
|
||||
//{
|
||||
// s_canvas_mgr.set_current(nullptr, false);
|
||||
//}
|
||||
//
|
||||
//void _3DScene::set_active(wxGLCanvas* canvas, bool active)
|
||||
//{
|
||||
// s_canvas_mgr.set_active(canvas, active);
|
||||
//}
|
||||
//#################################################################################################################
|
||||
|
||||
void _3DScene::set_active(wxGLCanvas* canvas, bool active)
|
||||
{
|
||||
s_canvas_mgr.set_active(canvas, active);
|
||||
}
|
||||
|
||||
void _3DScene::set_as_dirty(wxGLCanvas* canvas)
|
||||
{
|
||||
s_canvas_mgr.set_as_dirty(canvas);
|
||||
|
@ -519,9 +519,9 @@ public:
|
||||
//#################################################################################################################
|
||||
// static bool set_current(wxGLCanvas* canvas, bool force);
|
||||
// static void reset_current_canvas();
|
||||
//
|
||||
// static void set_active(wxGLCanvas* canvas, bool active);
|
||||
//#################################################################################################################
|
||||
|
||||
static void set_active(wxGLCanvas* canvas, bool active);
|
||||
static void set_as_dirty(wxGLCanvas* canvas);
|
||||
|
||||
static unsigned int get_volumes_count(wxGLCanvas* canvas);
|
||||
|
@ -1422,7 +1422,9 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||
, m_print(nullptr)
|
||||
, m_model(nullptr)
|
||||
, m_dirty(true)
|
||||
, m_active(true)
|
||||
//#################################################################################################################
|
||||
// , m_active(true)
|
||||
//#################################################################################################################
|
||||
, m_initialized(false)
|
||||
, m_use_VBOs(false)
|
||||
, m_force_zoom_to_bed_enabled(false)
|
||||
@ -1552,10 +1554,8 @@ bool GLCanvas3D::set_current()
|
||||
{
|
||||
if ((m_canvas != nullptr) && (m_context != nullptr))
|
||||
// if (m_active && (m_canvas != nullptr) && (m_context != nullptr))
|
||||
{
|
||||
// std::cout << "set_current: " << (void*)m_canvas << " - " << (void*)m_context << std::endl;
|
||||
return m_canvas->SetCurrent(*m_context);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1568,10 +1568,12 @@ bool GLCanvas3D::set_current()
|
||||
//}
|
||||
//#################################################################################################################
|
||||
|
||||
void GLCanvas3D::set_active(bool active)
|
||||
{
|
||||
m_active = active;
|
||||
}
|
||||
//#################################################################################################################
|
||||
//void GLCanvas3D::set_active(bool active)
|
||||
//{
|
||||
// m_active = active;
|
||||
//}
|
||||
//#################################################################################################################
|
||||
|
||||
void GLCanvas3D::set_as_dirty()
|
||||
{
|
||||
@ -2753,9 +2755,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
}
|
||||
else if (evt.LeftDClick() && (m_hover_volume_id != -1))
|
||||
{
|
||||
m_active = false;
|
||||
//#################################################################################################################
|
||||
// m_active = false;
|
||||
//#################################################################################################################
|
||||
m_on_double_click_callback.call();
|
||||
m_active = true;
|
||||
//#################################################################################################################
|
||||
// m_active = true;
|
||||
//#################################################################################################################
|
||||
}
|
||||
else if (evt.LeftDown() || evt.RightDown())
|
||||
{
|
||||
@ -2853,9 +2859,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
// if right clicking on volume, propagate event through callback
|
||||
if (m_volumes.volumes[volume_idx]->hover)
|
||||
{
|
||||
m_active = false;
|
||||
//#################################################################################################################
|
||||
// m_active = false;
|
||||
//#################################################################################################################
|
||||
m_on_right_click_callback.call(pos.x, pos.y);
|
||||
m_active = true;
|
||||
//#################################################################################################################
|
||||
// m_active = true;
|
||||
//#################################################################################################################
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,9 +401,11 @@ private:
|
||||
Model* m_model;
|
||||
|
||||
bool m_dirty;
|
||||
// the active member has been introduced to overcome a bug in wxWidgets method IsShownOnScreen() which always return true
|
||||
// when a window is inside a wxNotebook
|
||||
bool m_active;
|
||||
//#################################################################################################################
|
||||
// // the active member has been introduced to overcome a bug in wxWidgets method IsShownOnScreen() which always return true
|
||||
// // when a window is inside a wxNotebook
|
||||
// bool m_active;
|
||||
//#################################################################################################################
|
||||
bool m_initialized;
|
||||
bool m_use_VBOs;
|
||||
bool m_force_zoom_to_bed_enabled;
|
||||
@ -457,7 +459,9 @@ public:
|
||||
// bool set_current(bool force);
|
||||
//#################################################################################################################
|
||||
|
||||
void set_active(bool active);
|
||||
//#################################################################################################################
|
||||
// void set_active(bool active);
|
||||
//#################################################################################################################
|
||||
void set_as_dirty();
|
||||
|
||||
unsigned int get_volumes_count() const;
|
||||
|
@ -251,15 +251,15 @@ bool GLCanvas3DManager::init(wxGLCanvas* canvas)
|
||||
// m_current = nullptr;
|
||||
// return false;
|
||||
//}
|
||||
//
|
||||
//void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active)
|
||||
//{
|
||||
// CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
// if (it != m_canvases.end())
|
||||
// it->second->set_active(active);
|
||||
//}
|
||||
//#################################################################################################################
|
||||
|
||||
void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
it->second->set_active(active);
|
||||
}
|
||||
|
||||
void GLCanvas3DManager::set_as_dirty(wxGLCanvas* canvas)
|
||||
{
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
|
@ -74,8 +74,8 @@ public:
|
||||
|
||||
//#################################################################################################################
|
||||
// bool set_current(wxGLCanvas* canvas, bool force);
|
||||
// void set_active(wxGLCanvas* canvas, bool active);
|
||||
//#################################################################################################################
|
||||
void set_active(wxGLCanvas* canvas, bool active);
|
||||
void set_as_dirty(wxGLCanvas* canvas);
|
||||
|
||||
unsigned int get_volumes_count(wxGLCanvas* canvas) const;
|
||||
|
@ -190,13 +190,6 @@ remove_all_canvases()
|
||||
CODE:
|
||||
_3DScene::remove_all_canvases();
|
||||
|
||||
void
|
||||
set_active(canvas, active)
|
||||
SV *canvas;
|
||||
bool active;
|
||||
CODE:
|
||||
_3DScene::set_active((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), active);
|
||||
|
||||
void
|
||||
set_as_dirty(canvas)
|
||||
SV *canvas;
|
||||
|
Loading…
Reference in New Issue
Block a user