tags:

views:

53

answers:

0

I have big problem with my app on the iPhone. It's extremly slow. ( I run it on the simulator, but on device it's even slower) I'm using the newest Xcode and run it on the 4.0 simulator.

When I render 10 quads, I have 60 FPS. When I render 30 quads, I have 30 FPS

What's going on?

Here's my render function

(void)render
{
    // Replace the implementation of this method to do your own custom drawing

    // This application only creates a single context which is already set current at this point.
    // This call is redundant, but needed if dealing with multiple contexts.
    [EAGLContext setCurrentContext:context];

    // This application only creates a single default framebuffer which is already bound at this point.
    // This call is redundant, but needed if dealing with multiple framebuffers.
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

    static int obieg = 0;
    NSLog(@"wartosc: %i", obieg);
    obieg++;

    glViewport(0, 0, backingWidth, backingHeight);  


    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();


    glRotatef(-90, 0, 0, 1);

    glOrthof(0.0, 800, 0.0, 500, -1.0, 1.0);


    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();






    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glTranslatef(0.0, 0.0, -1.0f);

    glDisable(GL_TEXTURE_2D);


    for(int i=0; i<10; i++)
    {


    GLfloat squareVertices[] = {
        100.0f, 400.0f,
        500.5f, 400.0f,
        500.5f, 50.33f,
        100.0f,  50.33f
    };

    glVertexPointer(2, GL_FLOAT, 0, squareVertices);
    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
    }



    // This application only creates a single color renderbuffer which is already bound at this point.
    // This call is redundant, but needed if dealing with multiple renderbuffers.
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];

So what's can be wrong with that? Maybe I made some changes in project settings?

I guess that iPhone can rener even thousand triangles, not only few...