Merge pull request #578 from nicolas-f/master

updated osgviewerWX to remove deprecated calls in wxWidgets 3.x
This commit is contained in:
OpenSceneGraph git repository 2018-07-27 16:39:54 +01:00 committed by GitHub
commit 828c50afc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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;
}

View File

@ -38,12 +38,14 @@ public:
void UseCursor(bool value);
void SetContextCurrent();
private:
DECLARE_EVENT_TABLE()
osg::ref_ptr<osgViewer::GraphicsWindow> _graphics_window;
wxCursor _oldCursor;
wxGLContext _context;
};
class GraphicsWindowWX : public osgViewer::GraphicsWindow