Пример #1
0
        public Framebuffer(int width, int height)
            : this()
        {
            Width = width;
            Height = height;

            ColorTexture = new Texture(width, height);
            DepthTexture = new Texture(){ Width = width, Height = height };
            GL.TexImage2D(TextureTarget.Texture2D, 0,
                          PixelInternalFormat.DepthComponent32,
                          width, height, 0,
                          PixelFormat.DepthComponent,
                          PixelType.UnsignedInt, IntPtr.Zero);
            GL.BindTexture(TextureTarget.Texture2D, 0);

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, ID);
            GL.FramebufferTexture2D(FramebufferTarget.Framebuffer,
                                    FramebufferAttachment.ColorAttachment0,
                                    TextureTarget.Texture2D, ColorTexture.ID, 0);
            GL.FramebufferTexture2D(FramebufferTarget.Framebuffer,
                                    FramebufferAttachment.DepthAttachment,
                                    TextureTarget.Texture2D, DepthTexture.ID, 0);
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
        }
Пример #2
0
 public static void Rectangle(int x, int y, int width, int height, Texture tex, RectangleD texCoords)
 {
     Display.Texture = tex;
     Rectangle(x, y, width, height, texCoords);
 }
Пример #3
0
 public static void Rectangle(int x, int y, int width, int height, Texture tex)
 {
     Rectangle(x, y, width, height, tex, RectangleD.Unit);
 }
Пример #4
0
 public static void Rectangle(Rectangle rect, Texture tex, RectangleD texCoords)
 {
     Rectangle(rect.X, rect.Y, rect.Width, rect.Height, tex, texCoords);
 }
Пример #5
0
 public static void Rectangle(Rectangle rect, Texture tex)
 {
     Rectangle(rect, tex, RectangleD.Unit);
 }