Cube Code Help

So I’m attempting to draw a cube using glDrawArray and I can’t figure out why the polygons aren’t drawing correctly…my code is below.


import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
public class VortexRenderer implements GLSurfaceView.Renderer {
    private FloatBuffer _vertexBuffer;
    private FloatBuffer _colorBuffer;
    private int _nrOfVertices = 0;
    private float _xAngle;
    private float _yAngle;
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    public void onSurfaceChanged(GL10 gl, int w, int h) {
        gl.glViewport(0, 0, w, h);
    public void setXAngle(float angle) {
        _xAngle = angle;
    public float getXAngle() {
        return _xAngle;
    public void setYAngle(float angle) {
        _yAngle = angle;
    public float getYAngle() {
        return _yAngle;
    public void onDrawFrame(GL10 gl) {
        // define the color of clipping wall
        gl.glClearColor(0f, 0f, 0f, 1.0f);
        // reset the rotation matrix
        // clear the color buffer to show the called color
        // set the rotation
        gl.glRotatef(_xAngle, 1f, 0f, 0f);
        gl.glRotatef(_yAngle, 0f, 1f, 0f);
        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, _vertexBuffer);
        gl.glColorPointer(4, GL10.GL_FLOAT, 0, _colorBuffer);
        gl.glDrawArrays(GL10.GL_TRIANGLES, 0, _nrOfVertices);

 private void initShape() {
	    float[] coords = {
	    		0.0f,  0.0f,  0.0f,
	    		0.0f,  0.0f,  1.0f,
	    		0.0f,  1.0f,  0.0f,
	    		0.0f,  1.0f,  1.0f,
	    		1.0f,  0.0f,  0.0f,
	    		1.0f,  0.0f,  1.0f,
	    		1.0f,  1.0f,  0.0f,
	    		1.0f,  1.0f,  1.0f,
	    _nrOfVertices = coords.length;
	    float[] colors = {
	            1f, 0f, 0f, 1f, // red
	            0f, 1f, 0f, 1f, // green
	            0f, 0f, 1f, 1f, // blue
	            1f, 1f, 1f, 1f, // white
	            1f, 0f, 0f, 1f, // red
	            0f, 1f, 0f, 1f, // green
	            1f, 0f, 0f, 1f, // red
	            0f, 1f, 0f, 1f, // green
	    ByteBuffer vbb = ByteBuffer.allocateDirect(coords.length * 4);
	    _vertexBuffer = vbb.asFloatBuffer();
	    ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length * 4);
	    _colorBuffer = cbb.asFloatBuffer();

Any help would be most appreciated!