Thanks for your helping mind and reading this.
Here is my source: Download_Cocos2d_Continuous_Scrolling_Tile_Based_Game
Its continuously scrolling tile based cocos2D game. In this game, tileMaps are loaded and released on need basis - 3rd tile map is loaded when 1st one is released. Same process is repeated. Observed some jerk in tile scroll because of loading time. So I used separate thread to load tile map. That caused strange flash in screen..only in device.
- How can I fix this flash?
- How can I avoid little jerk in tile scroll? or any alternative method for loading?
Here is loading Code:
[NSThread detachNewThreadSelector:@selector(loadTileMapInThread:) toTarget:self withObject:nil];
-(void)loadTileMapInThread:(id)argument
{
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
CCGLView *view = (CCGLView*)[[CCDirector sharedDirector] view];
EAGLContext *auxGLcontext = [[EAGLContext alloc]
initWithAPI:kEAGLRenderingAPIOpenGLES2
sharegroup:[[view context] sharegroup]];
if( [EAGLContext setCurrentContext:auxGLcontext] ) {
[self LoadTilesMap];
glFlush(); //whn I comment this also..flash observed
[EAGLContext setCurrentContext:nil];
} else {
CCLOG(@"cocos2d: ERROR: TetureCache: Could not set EAGLContext");
}
[auxGLcontext release];
[autoreleasepool release];
}