Пример #1
0
        //public synchronized void update(final GL10 pGL) {
        public void Update(GL10 pGL)
        {
            lock (_methodLock)
            {
                //final ArrayList<Letter> lettersPendingToBeDrawnToTexture = this.mLettersPendingToBeDrawnToTexture;
                List <Letter> lettersPendingToBeDrawnToTexture = this.mLettersPendingToBeDrawnToTexture;
                if (lettersPendingToBeDrawnToTexture.Count > 0)
                {
                    int hardwareTextureID = this.mTexture.GetHardwareTextureID();

                    float textureWidth  = this.mTextureWidth;
                    float textureHeight = this.mTextureHeight;

                    for (int i = lettersPendingToBeDrawnToTexture.Count - 1; i >= 0; i--)
                    {
                        Letter letter = lettersPendingToBeDrawnToTexture[i];
                        Bitmap bitmap = this.GetLetterBitmap(letter.mCharacter);

                        GLHelper.BindTexture(pGL, hardwareTextureID);
                        GLUtils.TexSubImage2D(GL10Consts.GlTexture2d, 0, (int)(letter.mTextureX * textureWidth), (int)(letter.mTextureY * textureHeight), bitmap);

                        bitmap.Recycle();
                    }
                    lettersPendingToBeDrawnToTexture.Clear();
                    //System.gc();
                    // TODO: Verify if this is a good match: System.gc() -> Dispose() ... leaving it to standard GC at present
                }
            }
        }