X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42327c33878dca983e3b7fffda9bf612aea7689a..29188693b3b8ba4b07762df012cc652d421dae79:/src/osx/iphone/glcanvas.mm diff --git a/src/osx/iphone/glcanvas.mm b/src/osx/iphone/glcanvas.mm index 98e97dcc79..ca71c5bda3 100644 --- a/src/osx/iphone/glcanvas.mm +++ b/src/osx/iphone/glcanvas.mm @@ -46,6 +46,7 @@ @interface wxUICustomOpenGLView : UIView { + CGRect oldRect; EAGLContext* context; /* The pixel dimensions of the backbuffer */ @@ -61,6 +62,7 @@ - (BOOL) createFramebuffer; - (void) destroyFramebuffer; +- (id) initWithFrame:(CGRect) rect; @end @@ -80,6 +82,15 @@ } } +- (id) initWithFrame:(CGRect)rect +{ + if ( !(self=[super initWithFrame:rect]) ) + return nil; + + oldRect = rect; + return self; +} + - (BOOL)isOpaque { return YES; @@ -131,8 +142,15 @@ - (void) setContext:(EAGLContext*) ctx { context = ctx; [EAGLContext setCurrentContext:ctx]; - [self destroyFramebuffer]; - [self createFramebuffer]; +#if 0 + CGRect newRect = [self frame]; + if ( /* (CGRectEqualToRect(newRect, oldRect) == NO && ![self isHidden] && newRect.size.width > 0 && newRect.size.height > 0 ) + || */ viewFramebuffer == 0 ) + { + [self destroyFramebuffer]; + [self createFramebuffer]; + } +#endif glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); } @@ -141,6 +159,12 @@ [context presentRenderbuffer:GL_RENDERBUFFER_OES]; } +- (void)layoutSubviews { + [EAGLContext setCurrentContext:context]; + [self destroyFramebuffer]; + [self createFramebuffer]; +} + @end