@interface wxUICustomOpenGLView : UIView
{
+ CGRect oldRect;
EAGLContext* context;
/* The pixel dimensions of the backbuffer */
- (BOOL) createFramebuffer;
- (void) destroyFramebuffer;
+- (id) initWithFrame:(CGRect) rect;
@end
}
}
+- (id) initWithFrame:(CGRect)rect
+{
+ if ( !(self=[super initWithFrame:rect]) )
+ return nil;
+
+ oldRect = rect;
+ return self;
+}
+
- (BOOL)isOpaque
{
return YES;
- (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);
}
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
}
+- (void)layoutSubviews {
+ [EAGLContext setCurrentContext:context];
+ [self destroyFramebuffer];
+ [self createFramebuffer];
+}
+
@end