Code example for GL11

Methods: glBindBuffer, glBufferData, glClientActiveTexture, glTexCoordPointer, glVertexPointer

0
    } 
 
    public void bindArrays(GL10 gl) {
        GL11 gl11 = (GL11) gl;
        // draw using hardware buffers 
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertBufferIndex);
        gl11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
 
        gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mOverlayTextureCoordBufferIndex);
        if (mDynamicVBO && mQuadChanged) {
            final int texCoordSize = mOverlayTexCoordBuffer.capacity() * 4;
            mOverlayTexCoordBuffer.position(0);
            gl11.glBufferData(GL11.GL_ARRAY_BUFFER, texCoordSize, mOverlayTexCoordBuffer, GL11.GL_DYNAMIC_DRAW);
        } 
        gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
        gl11.glClientActiveTexture(GL11.GL_TEXTURE1);
        if (mDynamicVBO && mQuadChanged) {
            final int texCoordSize = mBaseTexCoordBuffer.capacity() * 4;
            mBaseTexCoordBuffer.position(0);
            gl11.glBufferData(GL11.GL_ARRAY_BUFFER, texCoordSize, mBaseTexCoordBuffer, GL11.GL_DYNAMIC_DRAW);
        } 
        gl11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
        gl11.glClientActiveTexture(GL11.GL_TEXTURE0);
        if (mDynamicVBO && mQuadChanged) {
            mQuadChanged = false;
            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertBufferIndex);
            final int vertexSize = mVertexBuffer.capacity() * 4;
            mVertexBuffer.position(0);
            gl11.glBufferData(GL11.GL_ARRAY_BUFFER, vertexSize, mVertexBuffer, GL11.GL_DYNAMIC_DRAW);
        } 
        gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBufferIndex);
    } 
 
    public static final void draw(GL11 gl11, float orientationDegrees) {
        // don't call this method unless bindArrays was called 
        int orientation = (int) Shared.normalizePositive(orientationDegrees);