Can anyone point me to a working demo using glDrawArrays()? I can’t make it work…
Here is my code :
gl.glEnableClientState(GL.GL_COLOR_ARRAY);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
float[] color = new float[]{0,1,0,0,1,0,0,1,0,0,1,0};
FloatBuffer fbuf = ByteBuffer.allocateDirect(0).asFloatBuffer();
fbuf.wrap(color);
gl.glColorPointer(3,GL.GL_FLOAT,0,fbuf);
float[] mypoint = new float[]{300,300,200,200,300,100,100,200};
FloatBuffer ibuf = ByteBuffer.allocateDirect(0).asFloatBuffer();
ibuf.wrap(mypoint);
gl.glVertexPointer(2,GL.GL_FLOAT,0,ibuf);
gl.glDrawArrays(GL.GL_LINE_LOOP,0,4);