Ejemplo n.º 1
0
        public GLBrush(GLBitmap bmp, bool tileX, bool tileY)
        {
            Bitmap = bmp;
            Color0 = Color.FromArgb(255, 255, 255, 255);

            GL.BindTexture(TextureTarget.Texture2D, bmp.Id);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)(tileX ? All.Repeat : All.ClampToEdge));
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)(tileY ? All.Repeat : All.ClampToEdge));
        }
Ejemplo n.º 2
0
        public void UpdateBitmap(GLBitmap bmp, int x, int y, int width, int height, int[] data)
        {
            var buffer = ByteBuffer.AllocateDirect(width * height * sizeof(int)).Order(ByteOrder.NativeOrder()).AsIntBuffer();

            buffer.Put(data);
            buffer.Position(0);

            GLES11.GlBindTexture(GLES11.GlTexture2d, bmp.Id);
            GLES11.GlTexSubImage2D(GLES11.GlTexture2d, 0, x, y, width, height, GLES11.GlRgba, GLES11.GlUnsignedByte, buffer);
        }
Ejemplo n.º 3
0
        // HACK : Very specific call only used by video rendering, too lazy to do the proper transforms.
        public void DrawRotatedFlippedBitmap(GLBitmap bmp, float x, float y, float width, float height)
        {
            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, bmp.Id);
            GL.Color4(1.0f, 1.0f, 1.0f, 1.0f);

            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0); GL.Vertex2(x - height, y);
            GL.TexCoord2(1, 0); GL.Vertex2(x - height, y - width);
            GL.TexCoord2(1, 1); GL.Vertex2(x, y - width);
            GL.TexCoord2(0, 1); GL.Vertex2(x, y);
            GL.End();

            GL.Disable(EnableCap.Texture2D);
        }
Ejemplo n.º 4
0
        public void DrawBitmap(GLBitmap bmp, float x, float y, float width, float height, float opacity)
        {
            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, bmp.Id);
            GL.Color4(1.0f, 1.0f, 1.0f, opacity);

            int x0 = (int)x;
            int y0 = (int)y;
            int x1 = (int)(x + width);
            int y1 = (int)(y + height);

            GL.Begin(BeginMode.Quads);
            GL.TexCoord2(0, 0); GL.Vertex2(x0, y0);
            GL.TexCoord2(1, 0); GL.Vertex2(x1, y0);
            GL.TexCoord2(1, 1); GL.Vertex2(x1, y1);
            GL.TexCoord2(0, 1); GL.Vertex2(x0, y1);
            GL.End();
            GL.Disable(EnableCap.Texture2D);
        }
Ejemplo n.º 5
0
 public float GetBitmapWidth(GLBitmap bmp)
 {
     return(bmp.Size.Width);
 }
Ejemplo n.º 6
0
 public GLBrush CreateBitmapBrush(GLBitmap bmp, bool tileX, bool tileY)
 {
     return(new GLBrush(bmp, tileX, tileY));
 }
Ejemplo n.º 7
0
 public void DrawBitmap(GLBitmap bmp, float x, float y, float opacity = 1.0f)
 {
     DrawBitmap(bmp, x, y, bmp.Size.Width, bmp.Size.Height, opacity);
 }
Ejemplo n.º 8
0
 public void DrawBitmap(GLBitmap bmp, float x, float y, float scale = 1.0f, float opacity = 1.0f)
 {
     DrawBitmap(bmp, x, y, bmp.Size.Width * scale, bmp.Size.Height * scale, opacity);
 }
Ejemplo n.º 9
0
 public void UpdateBitmap(GLBitmap bmp, int x, int y, int width, int height, int[] data)
 {
     GL.BindTexture(TextureTarget.Texture2D, bmp.Id);
     GL.TexSubImage2D(TextureTarget.Texture2D, 0, x, y, width, height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
 }