Index: trunk/src/wx/wx_canvas.cc
===================================================================
--- trunk/src/wx/wx_canvas.cc	(revision 470)
+++ trunk/src/wx/wx_canvas.cc	(revision 505)
@@ -13,5 +13,5 @@
 wxEND_EVENT_TABLE()
 
-nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent )
+nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent, input* in )
 	: wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
 	wxFULL_REPAINT_ON_RESIZE )
@@ -19,13 +19,32 @@
 	nv::load_gl_no_context();
 	wxClientDC dc( this );
+	m_render  = true;
+	m_wm      = new nv::sdl::window_manager;
+	m_device  = new nv::gl_device();
+	if ( !in ) in = new nv::sdl::input;
+	m_window = new nv::gl_window( m_device, m_wm, in, GetHWND(), dc.GetHDC() );
+	m_context = m_window->get_context();
+	m_main    = true;
+}
+
+nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent, wx_gl_canvas *sibling, input* in )
+	: wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+		wxFULL_REPAINT_ON_RESIZE )
+{
+	wxClientDC dc( this );
 	m_render = true;
-	m_wm = new nv::sdl::window_manager;
+	m_wm = sibling->m_wm;
 	m_device = new nv::gl_device();
-	m_window = new nv::gl_window( m_device, m_wm, new nv::sdl::input(), GetHWND(), dc.GetHDC() );
+	if ( !in ) in = new nv::sdl::input;
+	m_window = new nv::gl_window( m_device, m_wm, in, GetHWND(), dc.GetHDC() );
 	m_context = m_window->get_context();
+	make_current();
+	m_main = false;
+
 }
 
 nv::wx_gl_canvas::~wx_gl_canvas()
 {
+	make_current();
 	delete m_window;
 	delete m_device;
@@ -34,4 +53,5 @@
 void nv::wx_gl_canvas::on_paint( wxPaintEvent& )
 {
+	make_current();
 	const wxSize client_size = GetClientSize();
 	m_context->set_viewport( nv::ivec4( nv::ivec2(), client_size.x, client_size.y ) );
@@ -53,10 +73,16 @@
 void nv::wx_gl_canvas::on_idle( wxIdleEvent& evt )
 {
-	nv::sleep( 10 );
+	nv::sleep( 1 );
 	if ( m_render )
 	{
+		make_current();
 		on_update();
 		evt.RequestMore(); // render continuously, not only once on idle
 	}
+}
+
+void nv::wx_gl_canvas::make_current()
+{
+	m_window->make_current();
 }
 
