views:

541

answers:

1

Here, is the sample code which I am using. This code is in OpenGL. I want to port it to OpenGL ES. glArrayElement() is not supported in OpenGL ES. Instead, it was recommended to use glDrawElements(), glDrawArrays(). I am not able to convert this. Can you please help me out to convert the code.

glTexCoordPointer(2,GL_FLOAT,sizeof(struct texcoord),tex);
glColorPointer(4,GL_UNSIGNED_BYTE,4,col);
glNormalPointer(GL_FLOAT,sizeof(vector),wet->n);
glVertexPointer(2,GL_FLOAT,sizeof(struct vertexcoord),vert);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glLockArraysEXT(0,wet->w*wet->h);
i=0;
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();
}
glUnlockArraysEXT();

And one more question is do we have any replacement for glEnable(GL_TEXTURE_RECTANGLE_EXT) in OpenGL ES.

A: 

everything from glLockArrays down you can get rid of. just replace all that with glDrawArrays and youre done.