0
            // change clip rect. 
            if (textureWidth != newTextureWidth || textureHeight != newTextureHeight || mTextureId == 0) {
                // Allocate a texture if needed. 
                if (textureId == 0) {
                    int[] textureIdOut = new int[1];
                    gl.glGenTextures(1, textureIdOut, 0);
                    textureId = textureIdOut[0];
                    mNeedsResize = false;
                    mTextureId = textureId;
 
                    // Set texture parameters. 
                    gl.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
                    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);
                } 
 
                // Set the new texture width and height. 
                textureWidth = newTextureWidth;
                textureHeight = newTextureHeight;
                mTextureWidth = newTextureWidth;
                mTextureHeight = newTextureHeight;
                mNormalizedWidth = (float) width / textureWidth;
                mNormalizedHeight = (float) height / textureHeight;
 
                // Recycle the existing bitmap and create a new one. 
                if (bitmap != null)
                    bitmap.recycle();
                if (textureWidth > 0 && textureHeight > 0) {
                    bitmap = Bitmap.createBitmap(textureWidth, textureHeight, mBitmapConfig);
                    canvas.setBitmap(bitmap);
                    mBitmap = bitmap;
                } 
            } 
        } 
 
        // Bind the texture to the context. 
        if (textureId == 0) {
            return false; 
        } 
        gl.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
 
        // Redraw the contents of the texture if needed. 
        if (mNeedsDraw) {
            mNeedsDraw = false;
            renderCanvas(canvas, bitmap, width, height);
            int[] cropRect = { 0, height, width, -height };
            gl.glTexParameteriv(GL11.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, cropRect, 0);
            GLUtils.texImage2D(GL11.GL_TEXTURE_2D, 0, bitmap, 0);
 
        } 
 
        return true;