Code example for GL11

Methods: glBindTexture

0
                // OES_draw_texture. 
                int[] cropRect = {0,  mHeight, mWidth, - mHeight};
 
                // Upload the bitmap to a new texture. 
                gl.glGenTextures(1, textureId, 0);
                gl.glBindTexture(GL11.GL_TEXTURE_2D, textureId[0]);
                gl.glTexParameteriv(GL11.GL_TEXTURE_2D,
                        GL11Ext.GL_TEXTURE_CROP_RECT_OES, cropRect, 0);
                gl.glTexParameteri(GL11.GL_TEXTURE_2D,
                        GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP_TO_EDGE);
                gl.glTexParameteri(GL11.GL_TEXTURE_2D,
                        GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP_TO_EDGE);
                gl.glTexParameterf(GL11.GL_TEXTURE_2D,
                        GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
                gl.glTexParameterf(GL11.GL_TEXTURE_2D,
                        GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
                GLUtils.texImage2D(GL11.GL_TEXTURE_2D, 0, bitmap, 0);
            } finally { 
                freeBitmap(bitmap);
            } 
            if (glError == GL11.GL_OUT_OF_MEMORY) {
                throw new GLOutOfMemoryException(); 
            } 
            if (glError != GL11.GL_NO_ERROR) {
                mId = 0;
                mState = STATE_UNLOADED;
                throw new RuntimeException(
                        "Texture upload fail, glError " + glError);
            } else { 
                // Update texture state. 
                mGL = gl;
                mId = textureId[0];
                mState = Texture.STATE_LOADED;
            } 
        } else { 
            mState = STATE_ERROR;
            throw new RuntimeException("Texture load fail, no bitmap");
        } 
    } 
 
    public void draw(GLRootView root, int x, int y) {
        root.drawTexture(this, x, y, mWidth, mHeight);
    } 
 
    public void draw(GLRootView root, int x, int y, int w, int h, float alpha) {
        root.drawTexture(this, x, y, w, h, alpha);
    } 
 
    protected boolean bind(GLRootView root, GL11 gl) {
        if (mState == Texture.STATE_UNLOADED || mGL != gl) {
            mState = Texture.STATE_UNLOADED;
            try { 
                uploadToGL(gl);
            } catch (GLOutOfMemoryException e) {
                root.handleLowMemory();
                return false; 
            } 
        } else { 
            gl.glBindTexture(GL11.GL_TEXTURE_2D, getId());
        } 
        return true; 
    } 
 
    public void getTextureCoords(float coord[], int offset) {