updated osgviewerWX to remove deprecated calls in wxWidgets 3.x

This commit is contained in:
Alex Burton 2015-11-25 09:36:15 +11:00 committed by Robert Osfield
parent 467baa8c00
commit a7747972dc
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