public void OnDrawFrame(IGL10 gl)
        {
            try
            {
                if (!MInitialized)
                {
                    //Only need to do this once
                    MEffectContext = EffectContext.CreateWithCurrentGlContext();
                    MTexRenderer.Init();
                    LoadTextures();
                    MInitialized = true;
                }

                if (MCurrentEffect != PhotoFilter.None || MCustomEffect != null)
                {
                    //if an effect is chosen initialize it and apply it to the texture
                    InitEffect();
                    ApplyEffect();
                }

                RenderResult();

                if (!IsSaveImage)
                {
                    return;
                }

                MFilterBitmap = BitmapUtil.CreateBitmapFromGlSurface(this, gl);

                SetSourceBitmap(MFilterBitmap);

                Log.Debug("ImageFilterView", "onDrawFrame: " + MFilterBitmap);

                IsSaveImage = false;
                if (MOnSaveBitmap != null)
                {
                    new Handler(Looper.MainLooper).Post(new Runnable(Run));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        public void OnDrawFrame(IGL10 gl)
        {
            if (!_isInitialised)
            {
                _effectContext = EffectContext.CreateWithCurrentGlContext();
                Renderer.Init();
                LoadTextures();

                _isInitialised = true;
            }

            if (CurrentEffect != Resource.Id.none)
            {
                InitialiseEffect();
                ApplyEffect();
            }

            RenderResult();
        }