Exemplo n.º 1
0
        private void Load()
        {
            System.IO.Stream fs = null;
            try
            {
                IGL10 gl        = _glGraphics.GL10;
                int[] textureId = new int[1];
                gl.GlGenTextures(1, textureId, 0);
                _textureId = textureId [0];
                fs         = _fileIO.ReadAsset(_fileName);
                Bitmap b = BitmapFactory.DecodeStream(fs);

                gl.GlBindTexture(GL10.GlTexture2d, _textureId);

                SetFilters(GL10.GlNearest, GL10.GlNearest);

                Android.Opengl.GLUtils.TexImage2D(GL10.GlTexture2d, 0, b, 0);

                b.Recycle();
            }
            catch
            {
                throw new Java.Lang.RuntimeException("Couldn't load texture from asset");
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }