Destroy();
}
-bool MyFrame::OnClose(void)
-{
- return TRUE;
-}
-
BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
EVT_SIZE(TestGLCanvas::OnSize)
EVT_PAINT(TestGLCanvas::OnPaint)
/* must always be here */
wxPaintDC dc(this);
+#ifndef __WXMOTIF__
if (!GetContext()) return;
+#endif
SetCurrent();
{
int width, height;
GetClientSize(& width, & height);
-
+
+#ifndef __WXMOTIF__
if (GetContext())
+#endif
{
SetCurrent();
glViewport(0, 0, width, height);
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();