X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aae24d21a33faa2a23fccde24255365ca845c46f..a6aa9b1ee8aaecdf0ca4618c2e6cccfb011f4599:/utils/glcanvas/samples/penguin/penguin.cpp?ds=sidebyside diff --git a/utils/glcanvas/samples/penguin/penguin.cpp b/utils/glcanvas/samples/penguin/penguin.cpp index 9444b7ec08..8eaed6a1d9 100644 --- a/utils/glcanvas/samples/penguin/penguin.cpp +++ b/utils/glcanvas/samples/penguin/penguin.cpp @@ -76,11 +76,6 @@ void MyFrame::OnExit(wxCommandEvent& event) Destroy(); } -bool MyFrame::OnClose(void) -{ - return TRUE; -} - BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) EVT_SIZE(TestGLCanvas::OnSize) EVT_PAINT(TestGLCanvas::OnPaint) @@ -106,7 +101,9 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event ) /* must always be here */ wxPaintDC dc(this); +#ifndef __WXMOTIF__ if (!GetContext()) return; +#endif SetCurrent(); @@ -148,8 +145,10 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) { int width, height; GetClientSize(& width, & height); - + +#ifndef __WXMOTIF__ if (GetContext()) +#endif { SetCurrent(); glViewport(0, 0, width, height); @@ -183,20 +182,21 @@ void TestGLCanvas::LoadLWO(const wxString &filename) void TestGLCanvas::OnMouse( wxMouseEvent& event ) { + wxSize sz(GetClientSize()); if (event.Dragging()) { /* drag in progress, simulate trackball */ float spin_quat[4]; trackball(spin_quat, - (2.0*info.beginx - m_width) / m_width, - ( m_height - 2.0*info.beginy) / m_height, - ( 2.0*event.GetX() - m_width) / m_width, - ( m_height - 2.0*event.GetY()) / m_height); + (2.0*info.beginx - sz.x) / sz.x, + ( sz.y - 2.0*info.beginy) / sz.y, + ( 2.0*event.GetX() - sz.x) / sz.x, + ( sz.y - 2.0*event.GetY()) / sz.y); add_quats( spin_quat, info.quat, info.quat ); /* orientation has changed, redraw mesh */ - Refresh(); + Refresh(FALSE); } info.beginx = event.GetX();