Vertex array Help

Hi all,

Ive been working through a copy of the “red book” trying to update my code… and i come to the topic of using arrays… great they seem like a really good idea… problem is the commands dont seem to map perfectly from the gl spec to jogl…

Has anyone got a jogl example of defining a shape using an array ?

Thanks,
J.


            if (colors3f != null) {
                gl.glEnableClientState(gl.GL_COLOR_ARRAY);
                gl.glColorPointer(3, gl.GL_FLOAT, 0, colors3f);
            } else if (colors4f != null) {
                gl.glEnableClientState(gl.GL_COLOR_ARRAY);
                gl.glColorPointer(4, gl.GL_FLOAT, 0, colors4f);
            } else {
                gl.glDisableClientState(gl.GL_COLOR_ARRAY);
                gl.glColor3f(1,1,1);
            }

            if (normals != null) {
                gl.glEnableClientState(gl.GL_NORMAL_ARRAY);
                gl.glNormalPointer(gl.GL_FLOAT, 0, normals);
            } else {
                gl.glDisableClientState(gl.GL_NORMAL_ARRAY);
            }

            if (vectors != null) {
                gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
                gl.glVertexPointer(3, gl.GL_FLOAT, 0, vectors);
            }

            if (texCoords2D != null) {
                gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
                gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, texCoords2D);
            } else {
                gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
            }

            if (texCoords3D != null) {
                gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
//                gl.glTexCoordPointer(3, gl.GL_FLOAT, 0, texCoords3D);
            }

            gl.glDrawArrays(mode, 0, numVertices);