Example #1
0
 public void Blit()
 {
     if (msaa)
     {
         NativeGL.nglBlitFBO(FBO, WRITE_FBO, width, height);
     }
 }
Example #2
0
 public void Dispose()
 {
     if (Disposed)
     {
         return;
     }
     Disposed = true;
     NativeGL.nglDeleteFramebuffer(FBO);
     Opengl32.glDeleteTextures(1, new int[] { Texture });
 }
Example #3
0
        public static int LoadTexture(Bitmap bmp)
        {
            BitmapData dat  = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
            IntPtr     rgba = Marshal.AllocHGlobal(4 * bmp.Width * bmp.Height);

            NativeGL.nglARGBtoRGBA(rgba, dat.Scan0, bmp.Width * bmp.Height);
            int tex = LoadTexture(rgba, bmp.Width, bmp.Height);

            bmp.UnlockBits(dat);
            Marshal.FreeHGlobal(rgba);
            return(tex);
        }
Example #4
0
 public FrameBufferObject(int width, int height, int samples = 0)
 {
     Console.WriteLine("Create FBO {0}", Thread.CurrentThread.ManagedThreadId);
     this.width  = width;
     this.height = height;
     this.msaa   = samples > 0;
     if (!this.msaa)
     {
         Texture = Util.LoadTexture(IntPtr.Zero, width, height);
         FBO     = NativeGL.nglCreateFBO(Texture, width, height);
     }
     else
     {
         int tex = 0;
         texture1     = Util.LoadTexture(IntPtr.Zero, width, height);
         FBO          = NativeGL.nglCreateFBOMultisampling(ref tex, width, height, samples);
         WRITE_FBO    = NativeGL.nglCreateFBO(texture1, width, height);
         this.Texture = texture1;
     }
 }
Example #5
0
 public void Unbind()
 {
     NativeGL.nglBindFramebuffer(0);
 }
Example #6
0
 public void Bind()
 {
     NativeGL.nglBindFramebuffer(FBO);
 }