Code example for IntBuffer

Methods: position, put

0
        if ((colors != null) && mEmitColors) {
            ByteBuffer cbb =
                ByteBuffer.allocateDirect(colors.length * INT_BYTES);
            cbb.order(ByteOrder.nativeOrder());
            mColorBuffer = cbb.asIntBuffer();
            mColorBuffer.put(colors);
            mColorBuffer.position(0);
        } 
    } 
 
    /** 
     * Draws the shape to the given OpenGL ES 1.0 context.  Texture coordinates, 
     * normals, and colors are emitted according the the preferences set for 
     * this shape. 
     */ 
    public void draw(GL10 gl) {
        gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
 
        if (mEmitTextureCoordinates) {
            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);