From a7747972dc0376dd0c8962c641a62fcd1c5a689b Mon Sep 17 00:00:00 2001 From: Alex Burton Date: Wed, 25 Nov 2015 09:36:15 +1100 Subject: [PATCH] updated osgviewerWX to remove deprecated calls in wxWidgets 3.x --- examples/osgviewerWX/osgviewerWX.cpp | 12 ++++++++---- examples/osgviewerWX/osgviewerWX.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/osgviewerWX/osgviewerWX.cpp b/examples/osgviewerWX/osgviewerWX.cpp index 9b7ace40e..7befa2f30 100644 --- a/examples/osgviewerWX/osgviewerWX.cpp +++ b/examples/osgviewerWX/osgviewerWX.cpp @@ -140,7 +140,8 @@ END_EVENT_TABLE() OSGCanvas::OSGCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attributes) - : wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name, attributes) + : wxGLCanvas(parent, id, attributes, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name) + ,_context(this) { // default cursor to standard _oldCursor = *wxSTANDARD_CURSOR; @@ -150,6 +151,11 @@ OSGCanvas::~OSGCanvas() { } +void OSGCanvas::SetContextCurrent() +{ + _context.SetCurrent(*this); +} + void OSGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { /* must always be here */ @@ -158,8 +164,6 @@ void OSGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) void OSGCanvas::OnSize(wxSizeEvent& event) { - // this is also necessary to update the context on some platforms - wxGLCanvas::OnSize(event); // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) int width, height; @@ -337,7 +341,7 @@ void GraphicsWindowWX::useCursor(bool cursorOn) bool GraphicsWindowWX::makeCurrentImplementation() { - _canvas->SetCurrent(); + _canvas->SetContextCurrent(); return true; } diff --git a/examples/osgviewerWX/osgviewerWX.h b/examples/osgviewerWX/osgviewerWX.h index db41d24a2..9e0edbda8 100644 --- a/examples/osgviewerWX/osgviewerWX.h +++ b/examples/osgviewerWX/osgviewerWX.h @@ -38,12 +38,14 @@ public: void UseCursor(bool value); + void SetContextCurrent(); private: DECLARE_EVENT_TABLE() osg::ref_ptr _graphics_window; wxCursor _oldCursor; + wxGLContext _context; }; class GraphicsWindowWX : public osgViewer::GraphicsWindow