Prevent default OpenGL context creation in wxGLCanvas under macOS
This renders unnecessary the previous workarounds for using NSOpenGLView as the base class for wxGLCanvas view, so revert them. See: -2ab430965c
which introduced the use of NSOpenGLView (see https://github.com/wxWidgets/wxWidgets/pull/846). -ea68934b8e
for the first workaround due to the use of NSOpenGLView and its default context creation. -6974a6ceaa
for the refinement of the workaround above. -e6ae83c386
andb822e9efe8
which tweaked it futher. This commit renders unnecessary all the changes since the initial switch to NSOpenGLView by just preventing NSOpenGLView from creating its own context and thus enforcing the use of wxGLContext associated with wxGLCanvas. Closes https://github.com/wxWidgets/wxWidgets/pull/1617
This commit is contained in:
committed by
Vadim Zeitlin
parent
b97bf311e0
commit
3272509ae5
@@ -150,6 +150,13 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs,
|
||||
impl->doCommandBySelector(aSelector, self, _cmd);
|
||||
}
|
||||
|
||||
- (NSOpenGLContext *) openGLContext
|
||||
{
|
||||
// Prevent the NSOpenGLView from making it's own context
|
||||
// We want to force using wxGLContexts
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
bool wxGLCanvas::DoCreate(wxWindow *parent,
|
||||
@@ -201,24 +208,6 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
||||
|
||||
[m_glContext makeCurrentContext];
|
||||
|
||||
// the missing redraw upon resize problem only happens when linked against 10.14
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||
// At least under macOS 10.14.5 we need to do this in order to update the
|
||||
// context with the new size information after the window is resized.
|
||||
if ( WX_IS_MACOS_AVAILABLE_FULL(10, 14, 5) )
|
||||
{
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 15) )
|
||||
{
|
||||
// no workaround needed under 10.15 anymore
|
||||
}
|
||||
else
|
||||
{
|
||||
NSOpenGLView *v = (NSOpenGLView *)win.GetHandle();
|
||||
[v setOpenGLContext: m_glContext];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user