[iPhone] Please help with OpenGL ES optimization

Hello!
Haven't asked for help in a while, but this time I am really without ideas.
Basically I am working on this 2D Game which should be released soon, but drawing performance is rather miserable (~25 Fps, playable but not enjoyable).
If there are some optimizations please give me a hint, Im a beginner with OpenGL
Here is my OpenGL Code:
[EAGLContext setCurrentContext:context];
glViewport(0, 0, backingWidth, backingHeight);
glBindFramebufferOES(GLFRAMEBUFFEROES, viewFramebuffer);
glClear(GLCOLOR_BUFFERBIT);
Paddle* paddle = gModel.paddle;
////////////////DRAWING MAID///////////////////
ATTexture2D* maidTex = charImgA[gModel.mascotState];
if (!maidTex) {
//Lazy Loading
UIImage* img = [UIImage imageNamed:[NSString stringWithFormat:@"char-%d.png", gModel.mascotState, nil]];
maidTex = [[ATTexture2D alloc] initWithImage:img];
charImgA[gModel.mascotState] = maidTex;
int msImgWidth = 77;
int msImgHeight = 133;
CGRect maidRect = CGRectMake(paddle.box->center.x - (msImgWidth/2), 480-msImgHeight, msImgWidth, msImgHeight);
[maidTex drawInRect:maidRect];
////////////////DRAWING PADDLE///////////////////
CGRect rect = CGRectMake(paddle.box->getPoint(0).x,paddle.box->getPoint(0).y , paddle.box->extent.x * 2, paddle.box->extent.y * 2);
glPushMatrix();
glTranslatef(paddle.box->center.x, paddle.box->center.y, 0);
glRotatef(paddle.rotateState, 0, 0, 1);
glTranslatef(-paddle.box->center.x, -paddle.box->center.y, 0);
[paddleImg drawInRect:rect];
glPopMatrix();
////////////////DRAWING BLOCKS///////////////////
//We have 4 types of image pools
//Each type of block should take a picture from exactly one of the pools
//Here about 90 blocks loaded
NSArray* blockA = [gModel.blockMan getAllBlocks];
for (Block* block in blockA) {
CGRect rect = CGRectMake(block.box->getPoint(0).x,block.box->getPoint(0).y , block.box->extent.x * 2, block.box->extent.y * 2);
//Map the blocktype to the index of the pool->What pool should be used for this image?
int arrayIndex = blockTypeToImageAMappingA[block.type];
//Get the pool from the array
NSArray* imgPool = [blockImgAA objectAtIndex:arrayIndex];
//Get the array of the blockstates
//Choose one of the pictures from the pool to draw, this stays the same for the lifetime of the block, but is random
NSArray* imgA = [imgPool objectAtIndex:block.randID%[imgPool count]];
//Get the texture according to state of block
int index = MIN([imgA count]-1, block.state);
ATTexture2D* tex = [imgA objectAtIndex:index];
//block.blockImg = [imgA objectAtIndex:index];
//Draw the chosen texture
[tex drawInRect:rect];
////////////////DRAWING BALLS///////////////////
//About 10-20 should be supported
for (int i=0; i<[gModel.specialA count]; i++) {
Ball* ball = [gModel.specialA objectAtIndex:i];
ATTexture2D* tex = specialImgA [ball.specialType];
if (!tex) {
//Lazy Loading
NSString* str = [NSString stringWithFormat:@"special-%d%d.png", ball.specialType/10, ball.specialType%10, nil];
tex = [[ATTexture2D alloc] initWithImage:[UIImage imageNamed:str]];
specialImgA[ball.specialType] = tex;
[tex drawAtPoint:[ball getCenter]];
for (int i=0; i<[gModel.ballA count]; i++) {
Ball* ball = [gModel.ballA objectAtIndex:i];
[ballImg drawAtPoint:[ball getCenter]];
glBindRenderbufferOES(GLRENDERBUFFEROES, viewRenderbuffer);
[context presentRenderbuffer:GLRENDERBUFFEROES];
Comments: ATTexture is basically Apples Texture2D
Message was edited by: Max Ullinger

If rendering is slow, maybe it's because the textures aren't in a hardware-friendly format. CrashLanding's Texture2D class only supports RGBA8888, RGB565, and A8, i.e. no PVRTC textures. Another possibility is that you're rendering with alpha-testing/alpha-blending. The iPhone's GPU is supposed to be a lot faster if you draw as much geometry as you can without alpha-testing or alpha-blending -- it's part of their tile-based deferred rendering (TBDR).
If the CPU is slow, maybe it's all the Objective-C method calls. Each one of those is technically a search through the class hierarchy to find an appropriate method.
That's all I can see.

Similar Messages

Maybe you are looking for

  • How to change the SID during system copy

    This blog /people/johannes.heinrich/blog/2006/07/07/new-features-in-db2-udb-v9--part-3 (i.e.  the "new feature of V9" in this group) only talk about the system copy without changing the SID. In reality, we often want to change the SID during the syst

  • Composition of business team in GRC Access control project

    Hi Can I get any information about the composition of business team in a GRC access control project? What type of people form this team? Please provide some clarity on the role of business people in this type of projects. Regards Abhijeet

  • Errors running MRUA for Metadata Repository Upgrade to version 10.1.2.0.2

    Hi, I am encountering the following errors trying to run the MRUA for our Metadata Repository Upgrade on an AIX 5.3 box: <mrua_runs> ../mrua/mrua.sh -oracle_home /u01/oracle/product/9.2.0.8 -oid_host ourhost.domain.com -oid_ssl_port 3130 Executing mr

  • Spot visualization option

    i seem to have lost the abiity to use the spot visualization option in lightroom 5.2... anyone experiencing the same problem and do you have a solution?? thanks

  • Buying a new JDBC driver

    Hi There, I am a student and currently working on a ASP ->MS ACCESS application. I have converted that application to JSP->MS ACCESS. Now I am planning to migrate to JSP->Oracle and want to buy a JDBC driver for the same. Can anybody guide me to buyi