]> git.saurik.com Git - wxWidgets.git/commitdiff
refresh GL canvas itself, not the frame, when the GL context changes, otherwise it...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Apr 2007 00:02:15 +0000 (00:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Apr 2007 00:02:15 +0000 (00:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/opengl/cube/cube.cpp
samples/opengl/cube/cube.h

index b5f5ba419e1dfc45a62c0b6dc9f71df53bbfa80e..783ed604e7a470fa866c5c439d6f9ebd8163fd1a 100644 (file)
@@ -243,7 +243,8 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event )
           i != wxTopLevelWindows.end();
           ++i )
     {
-        (*i)->Refresh(false);
+        MyFrame *frame = (MyFrame *)*i;
+        frame->RefreshCanvas();
     }
 }
 
@@ -287,3 +288,7 @@ void MyFrame::OnNewWindow( wxCommandEvent& WXUNUSED(event) )
     (void) new MyFrame();
 }
 
+void MyFrame::RefreshCanvas()
+{
+    m_canvas->Refresh(false);
+}
index 56e6899fc7056861bf161562abdef3a2d77781ad..1fa19dc7c91876dd428af501d05aad4bf26bf49e 100644 (file)
@@ -40,12 +40,16 @@ class MyFrame: public wxFrame
 public:
     MyFrame();
 
+    // update the image shown on the canvas (after the shared wxGLContext was
+    // updated, presumably)
+    void RefreshCanvas();
+
+private:
     void OnExit(wxCommandEvent& event);
     void OnNewWindow(wxCommandEvent& event);
     void OnDefRotateLeftKey(wxCommandEvent& event);
     void OnDefRotateRightKey(wxCommandEvent& event);
 
-private:
     TestGLCanvas *m_canvas;
 
     DECLARE_EVENT_TABLE()
@@ -56,11 +60,11 @@ class TestGLCanvas : public wxGLCanvas
 public:
     TestGLCanvas(wxWindow *parent);
 
+private:
     void OnPaint(wxPaintEvent& event);
     void OnSize(wxSizeEvent& event);
     void OnKeyDown(wxKeyEvent& event);
 
-private:
     // OpenGL calls can't be done until we're initialized
     bool IsInitialized() const { return m_gllist != 0; }