/// <summary> /// /// </summary> /// <param name="first"></param> /// <param name="second"></param> /// <param name="type">Linear interpolation or cosine</param> /// <param name="frames">Number of frames until the picture completely changes to the second one, then goes back to the first one</param> public TransitioningImage(Texture first, Texture second, TransitionType type, int frames, bool animateFirstAlpha = true) { First = new TexturedRectangle(first); Second = new TexturedRectangle(second); Type = type; Frames = frames; AnimateFirstImageAlpha = animateFirstAlpha; AddChild(First); AddChild(Second); }
public CenteredTexture(Texture texture) { Texture = texture; FilledPolygons.AddLast(new Polygon(true, -Texture.Width / 2, -Texture.Height / 2, 0, 0, Texture.Width / 2, -Texture.Height / 2, 1, 0, Texture.Width / 2, Texture.Height / 2, 1, 1, Texture.Width / 2, Texture.Height / 2, 1, 1, -Texture.Width / 2, Texture.Height / 2, 0, 1, -Texture.Width / 2, -Texture.Height / 2, 0, 0)); SetPolygons(); }
public void AttachTexture(Texture texture) { this.texture = texture; Bind(); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, texture.Id, 0); GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, depthStencilRenderBuffer); GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferStorage.Depth24Stencil8, (int)texture.Width, (int)texture.Height); GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthStencilAttachment, RenderbufferTarget.Renderbuffer, depthStencilRenderBuffer); DepthStencilRenderBuffer = depthStencilRenderBuffer; Unbind(); }
public void RenderToTexture(Texture texture, bool clear) { frameBuffer.AttachTexture(texture); frameBuffer.Bind(); int oldWidth = Firefly.ViewportWidth; int oldHeight = Firefly.ViewportHeight; Firefly.ChangeViewPort((int)texture.Width, (int)texture.Height); if (clear) GL.Clear(ClearBufferMask.ColorBufferBit); Render(); Firefly.ChangeViewPort(oldWidth, oldHeight); frameBuffer.Unbind(); }
public TexturedButton(Texture button) { var up = new TexturedRectangle(button); var down = new TexturedRectangle(button); var shadow = new ColoredRectangle(0, 0, button.Width, button.Height, 0, 0, 0, 0.1F); down.AddChild(shadow); var hover = new TexturedRectangle(button); var light = new ColoredRectangle(0, 0, button.Width, button.Height, 1, 1, 1, 0.1F); hover.AddChild(light); var skin = new ButtonSkin(up, down, hover); Initialize(button.Width, button.Height); }
public void LoadTexture(Texture Texture) { Texture.Bind(); GL.Uniform1(location, 0); }
public TexturedButton(Texture up, Texture down, Texture hover) { var skin = new ButtonSkin(new TexturedRectangle(up), new TexturedRectangle(down), new TexturedRectangle(hover)); Initialize(up.Width, up.Height); }
public Texture RenderToNewTexture(int width, int height) { var temp = new Texture(width, height); RenderToTexture(temp, false); return temp; }
public void CopyFrom(Texture source) { source.Bind(); GL.BindBuffer(BufferTarget.PixelUnpackBuffer, pixelBuffer); GL.BufferData(BufferTarget.PixelUnpackBuffer, new IntPtr((int)source.Width * (int)source.Height * 4), IntPtr.Zero, BufferUsageHint.StaticDraw); var pointer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly); GL.GetTexImage(TextureTarget.Texture2D, 0, PixelFormat.Rgba, PixelType.Byte, pointer); GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer); Bind(); Width = source.Width; Height = source.Height; GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)source.Width, (int)source.Height, PixelFormat.Rgba, PixelType.Byte, IntPtr.Zero); GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0); }
public TexturedRectangle(float x, float y, float width, float height, Texture texture) : this(x, y, width, height) { Texture = texture; }
public TexturedRectangle(Texture texture, float width, float height) : this(0, 0, width, height, texture) { }
public TexturedRectangle(float x, float y, Texture texture) : this(x, y, texture.Width, texture.Height, texture) { }
public TexturedRectangle(Texture texture) : this(0, 0, texture.Width, texture.Height, texture) { }
public static void StartRenderingToTexture(Texture texture) { }