optimizing creation of glcontexts, less flicker
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
@interface wxUICustomOpenGLView : UIView
|
@interface wxUICustomOpenGLView : UIView
|
||||||
{
|
{
|
||||||
|
CGRect oldRect;
|
||||||
EAGLContext* context;
|
EAGLContext* context;
|
||||||
|
|
||||||
/* The pixel dimensions of the backbuffer */
|
/* The pixel dimensions of the backbuffer */
|
||||||
@@ -61,6 +62,7 @@
|
|||||||
|
|
||||||
- (BOOL) createFramebuffer;
|
- (BOOL) createFramebuffer;
|
||||||
- (void) destroyFramebuffer;
|
- (void) destroyFramebuffer;
|
||||||
|
- (id) initWithFrame:(CGRect) rect;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -80,6 +82,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) initWithFrame:(CGRect)rect
|
||||||
|
{
|
||||||
|
if ( !(self=[super initWithFrame:rect]) )
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
oldRect = rect;
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)isOpaque
|
- (BOOL)isOpaque
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
@@ -131,8 +142,15 @@
|
|||||||
- (void) setContext:(EAGLContext*) ctx {
|
- (void) setContext:(EAGLContext*) ctx {
|
||||||
context = ctx;
|
context = ctx;
|
||||||
[EAGLContext setCurrentContext:ctx];
|
[EAGLContext setCurrentContext:ctx];
|
||||||
|
#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 destroyFramebuffer];
|
||||||
[self createFramebuffer];
|
[self createFramebuffer];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
|
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +159,12 @@
|
|||||||
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
|
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)layoutSubviews {
|
||||||
|
[EAGLContext setCurrentContext:context];
|
||||||
|
[self destroyFramebuffer];
|
||||||
|
[self createFramebuffer];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user