Beispiel #1
0
        public override void BeginDraw(Renderer r)
        {
            Tilemap tilemap;

            SpriteTemplate tmp = Font.Template;

            if(!r.Tilemaps.TryGetValue(tmp.TilemapName, out tilemap))
            {
                r.Tilemaps[tmp.TilemapName] = tilemap = new Tilemap (tmp.TilemapName);
            }

            GL.BindTexture (TextureTarget.Texture2D, tilemap.Texture);

            //Flags type = _flags & Drawable.Flags.TypeMask;

            GL.Enable (EnableCap.Blend);
            GL.BlendFunc (BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

            _material.Bind();
        }
Beispiel #2
0
 public void SetTilemap(string name, Tilemap tilemap)
 {
     int texture_location = GL.GetUniformLocation(_program, name);
     GL.Uniform1(texture_location, 0);
     GL.BindTexture(TextureTarget.Texture2D, tilemap.Texture);
 }
Beispiel #3
0
        public override void BeginDraw(Renderer r)
        {
            Tilemap tilemap;

            if(!r.Tilemaps.TryGetValue(Template.TilemapName, out tilemap))
            {
                r.Tilemaps[Template.TilemapName] = tilemap = new Tilemap (Template.TilemapName);
            }

            GL.BindTexture (TextureTarget.Texture2D, tilemap.Texture);

            Flags type = _flags & Drawable.Flags.TypeMask;

            if(Drawable.Flags.TypeNoBlend == type)
            {
                GL.Disable (EnableCap.Blend);
            }
            else
            {
                GL.Enable (EnableCap.Blend);
                GL.BlendFunc (BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);
            }

            if(_material == null)
            {
                _material = r.GetMaterial("sprite");
            }

            _material.Bind();
        }