X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4825ef73a5f190b8f39c59df098c3f39fa4464b..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/osx/cocoa/glcanvas.mm?ds=inline diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index 0952fc18f3..83c99ce833 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -35,7 +35,6 @@ #include "wx/osx/private.h" - WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ) { WXGLContext context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext: shareContext]; @@ -78,9 +77,9 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) { NSOpenGLPFADoubleBuffer, NSOpenGLPFAMinimumPolicy, - NSOpenGLPFAColorSize,8, - NSOpenGLPFAAlphaSize,0, - NSOpenGLPFADepthSize,8, + NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8, + NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0, + NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8, (NSOpenGLPixelFormatAttribute)nil }; @@ -122,12 +121,12 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) case WX_GL_AUX_BUFFERS: data[p++] = NSOpenGLPFAAuxBuffers; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_RED: data[p++] = NSOpenGLPFAColorSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_GREEN: @@ -142,22 +141,22 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) case WX_GL_MIN_ALPHA: data[p++] = NSOpenGLPFAAlphaSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_DEPTH_SIZE: data[p++] = NSOpenGLPFADepthSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_STENCIL_SIZE: data[p++] = NSOpenGLPFAStencilSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_ACCUM_RED: data[p++] = NSOpenGLPFAAccumSize; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; case WX_GL_MIN_ACCUM_GREEN: @@ -185,7 +184,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) } data[p++] = NSOpenGLPFASampleBuffers; - if ( (data[p++] = attribList[arg++]) == true ) + if ( (data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]) == true ) { // don't use software fallback data[p++] = NSOpenGLPFANoRecovery; @@ -202,7 +201,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) } data[p++] = NSOpenGLPFASamples; - data[p++] = attribList[arg++]; + data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; break; } } @@ -212,7 +211,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) attribs = data; } - return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + return [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*) attribs]; } bool wxGLContext::SetCurrent(const wxGLCanvas& win) const @@ -230,39 +229,21 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const @interface wxNSCustomOpenGLView : NSView { - wxWidgetImpl* impl; NSOpenGLContext* context; } -- (id)initWithFrame:(NSRect)frame; -- (void)setImplementation: (wxWidgetImpl *) theImplementation; -- (wxWidgetImpl*) implementation; -- (BOOL) isFlipped; - @end @implementation wxNSCustomOpenGLView -- (id)initWithFrame:(NSRect)frame -{ - [super initWithFrame:frame]; - impl = NULL; - return self; -} - -- (void)setImplementation: (wxWidgetImpl *) theImplementation -{ - impl = theImplementation; -} - -- (wxWidgetImpl*) implementation -{ - return impl; -} - -- (BOOL) isFlipped ++ (void)initialize { - return YES; + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); + } } - (BOOL)isOpaque @@ -294,7 +275,6 @@ bool wxGLCanvas::Create(wxWindow *parent, NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r]; m_peer = new wxWidgetCocoaImpl( this, v ); - [v setImplementation:m_peer]; MacPostControlCreate(pos, size) ; */