refresh GL canvas itself, not the frame, when the GL context changes, otherwise it doesn't redraw under wxGTK1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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; }
|
||||
|
||||
|
Reference in New Issue
Block a user