• Paladin of the Pegasos
    Paladin of the Pegasos
    Jupp3
    Posts: 1193 from 2003/2/24
    From: Helsinki, Finland
    Not tested, but perhaps you could replace the immediate mode part (anything between glBegin() and glEnd(), including those lines) with:
    const GLfloat va[]=
    {-0.5f,-0.5f,+0.5f,
    +0.5f,-0.5f,+0.5f,
    +0.5f,+0.5f,+0.5f,
    -0.5f,+0.5f,+0.5f};

    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, 0, va);
    glDrawArrays(GL_TRIANGLE_FAN, 0, 4*3);
    glDisableClientState(GL_VERTEX_ARRAY);

    Of course you can skip last glDisableClientState(), as you probably want to keep that enabled anyway (you should of course disable it for color, normal etc. when you want to switch to "Giving a constant value with glColor*(), glNormal() etc.)
    GL_TRIANGLE_FAN instead of GL_QUADS because they do essentially the same thing (only with exactly one quad, as in this case), but unlike GL_QUADS, GL_TRIANGLE_FAN actually is implemented in OpenGL ES1, so at least that line should work on mobile devices too :-)
  • »19.01.12 - 11:29
    Profile Visit Website