views:

299

answers:

1

Hello everyone, I am trying to convert an openGL application to make it work for iPhone. I am almost finished with everything. but got nothing & stuck up with this part. Can anyone tell me is everything ok with the following converted part.

for(int y=0;y<wet->h-1;y++)
{
    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE,tex);
    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE,col);
    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE,vert);

    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE, &tex[i+wet->w]);
    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE, &col[i+wet->w]);
    glDrawElements(GL_TRIANGLE_STRIP, wet->w, GL_UNSIGNED_BYTE, &vert[i+wet->w]);
}

in place of:

for(int y=0;y<wet->h-1;y++)
{
    glBegin(GL_TRIANGLE_STRIP);
    for(int x=0;x<wet->w;x++)
    {
     glArrayElement(i);
     glArrayElement(i+wet->w);
     i++;
    }
    glEnd();
}
A: 

It could be useful if you say what problem you're seeing.

You seem to not be incrementing i in the new loop. How about a little i += wet->w, or using y * wet->w instead of i?

Jesse Rusak
Thanks for the reply...I have incremented i,but not shown here..the problem is its not showing anything except the black screen. is this the right way of conversion?