From 3063ea6ca9590f78875860a3bcd3be02a06bfc73 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 25 Sep 2017 17:42:11 +0200 Subject: [PATCH] Fixing Creation of wxGLCanvas on iOS --- include/wx/osx/glcanvas.h | 9 +++++++++ src/osx/glcanvas_osx.cpp | 7 ++++++- src/osx/iphone/glcanvas.mm | 13 +++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/wx/osx/glcanvas.h b/include/wx/osx/glcanvas.h index 24cac5b5d2..dda9ab2ed4 100644 --- a/include/wx/osx/glcanvas.h +++ b/include/wx/osx/glcanvas.h @@ -158,6 +158,15 @@ public: // implementation-only from now on protected: +#if wxOSX_USE_IPHONE + bool DoCreate(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name); + +#endif WXGLPixelFormat m_glFormat; wxGLAttributes m_GLAttrs; diff --git a/src/osx/glcanvas_osx.cpp b/src/osx/glcanvas_osx.cpp index 992d435bcc..66d4c3cd77 100644 --- a/src/osx/glcanvas_osx.cpp +++ b/src/osx/glcanvas_osx.cpp @@ -501,9 +501,14 @@ bool wxGLCanvas::Create(wxWindow *parent, // Make a copy of attributes. Will use at wxGLContext ctor m_GLAttrs = dispAttrs; +#if wxOSX_USE_IPHONE + if ( !wxGLCanvas::DoCreate(parent,id,pos,size,style,name) ) + return false; +#else if ( !wxWindow::Create(parent, id, pos, size, style, name) ) return false; - +#endif + return true; } diff --git a/src/osx/iphone/glcanvas.mm b/src/osx/iphone/glcanvas.mm index 9883f9f0e3..d5125c0086 100644 --- a/src/osx/iphone/glcanvas.mm +++ b/src/osx/iphone/glcanvas.mm @@ -205,7 +205,10 @@ void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ) } -WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) +WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, + int n1, + const int *ctxAttrs, + int n2) { #if 0 NSOpenGLPixelFormatAttribute data[512]; @@ -349,7 +352,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) return [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*) attribs]; #endif - return NULL; + return @"dummy"; } bool wxGLContext::SetCurrent(const wxGLCanvas& win) const @@ -364,14 +367,12 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const #define USE_SEPARATE_VIEW 1 -bool wxGLCanvas::Create(wxWindow *parent, +bool wxGLCanvas::DoCreate(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, - const wxString& name, - const int *attribList, - const wxPalette& WXUNUSED(palette)) + const wxString& name) { /* m_glFormat = WXGLChoosePixelFormat(attribList);