Skip to content

Commit dfc15ae

Browse files
committed
View size fix for CCFrameBufferObject.
1 parent fa1210d commit dfc15ae

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

CCRendererGLSupport.m

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,8 @@ -(void)bindWithClear:(GLbitfield)mask color:(GLKVector4)color4 depth:(GLclampf)d
386386

387387
-(void)syncWithView:(CC_VIEW<CCDirectorView> *)view;
388388
{
389-
CCGLView *glView = (CCGLView *)view;
390-
391-
CGFloat contentScale = [CCDirector sharedDirector].contentScaleFactor;
392-
self.sizeInPixels = CC_SIZE_SCALE(view.bounds.size, contentScale);
393-
self.contentScale = contentScale;
394-
395-
_fbo = glView.fbo;
389+
[super syncWithView:view];
390+
_fbo = [(CCGLView *)view fbo];
396391
}
397392

398393
@end

cocos2d/CCRendererBasicTypes.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ -(void)bindWithClear:(GLbitfield)mask color:(GLKVector4)color4 depth:(GLclampf)d
445445
{NSAssert(NO, @"Must be overridden.");}
446446

447447
-(void)syncWithView:(CC_VIEW<CCDirectorView> *)view;
448-
{NSAssert(NO, @"Must be overridden.");}
448+
{
449+
CCDirector *director = [CCDirector sharedDirector];
450+
self.sizeInPixels = director.viewSizeInPixels;
451+
self.contentScale = director.contentScaleFactor;
452+
}
449453

450454
@end

cocos2d/Platforms/iOS/CCMetalSupport.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,8 @@ -(void)bindWithClear:(GLbitfield)mask color:(GLKVector4)color4 depth:(GLclampf)d
189189

190190
-(void)syncWithView:(CC_VIEW<CCDirectorView> *)view;
191191
{
192-
CCMetalView *metalView = (CCMetalView *)view;
193-
self.sizeInPixels = CC_SIZE_SCALE(view.bounds.size, view.contentScaleFactor);
194-
self.contentScale = view.contentScaleFactor;
195-
196-
_frameBufferTexture = metalView.destinationTexture;
192+
[super syncWithView:view];
193+
_frameBufferTexture = [(CCMetalView *)view destinationTexture];
197194
}
198195

199196
@end

0 commit comments

Comments
 (0)